1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.lum.lu.ui.course.client.controllers; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.List; |
20 | |
|
21 | |
import org.kuali.student.common.assembly.data.Data; |
22 | |
import org.kuali.student.common.assembly.data.Metadata; |
23 | |
import org.kuali.student.common.dto.DtoConstants; |
24 | |
import org.kuali.student.common.rice.authorization.PermissionType; |
25 | |
import org.kuali.student.common.ui.client.application.Application; |
26 | |
import org.kuali.student.common.ui.client.application.KSAsyncCallback; |
27 | |
import org.kuali.student.common.ui.client.application.ViewContext; |
28 | |
import org.kuali.student.common.ui.client.configurable.mvc.layouts.DocumentLayoutController; |
29 | |
import org.kuali.student.common.ui.client.configurable.mvc.layouts.TabMenuController; |
30 | |
import org.kuali.student.common.ui.client.mvc.Callback; |
31 | |
import org.kuali.student.common.ui.client.mvc.DataModel; |
32 | |
import org.kuali.student.common.ui.client.mvc.DataModelDefinition; |
33 | |
import org.kuali.student.common.ui.client.mvc.ModelProvider; |
34 | |
import org.kuali.student.common.ui.client.mvc.ModelRequestCallback; |
35 | |
import org.kuali.student.common.ui.client.mvc.WorkQueue; |
36 | |
import org.kuali.student.common.ui.client.mvc.WorkQueue.WorkItem; |
37 | |
import org.kuali.student.common.ui.client.mvc.dto.ReferenceModel; |
38 | |
import org.kuali.student.common.ui.client.security.AuthorizationCallback; |
39 | |
import org.kuali.student.common.ui.client.security.RequiresAuthorization; |
40 | |
import org.kuali.student.common.ui.client.util.ExportElement; |
41 | |
import org.kuali.student.common.ui.client.util.ExportUtils; |
42 | |
import org.kuali.student.common.ui.client.util.WindowTitleUtils; |
43 | |
import org.kuali.student.common.ui.client.widgets.KSButton; |
44 | |
import org.kuali.student.common.ui.client.widgets.KSButtonAbstract.ButtonStyle; |
45 | |
import org.kuali.student.common.ui.client.widgets.KSLabel; |
46 | |
import org.kuali.student.common.ui.client.widgets.KSLightBox; |
47 | |
import org.kuali.student.common.ui.client.widgets.field.layout.layouts.VerticalFieldLayout; |
48 | |
import org.kuali.student.common.ui.client.widgets.notification.KSNotification; |
49 | |
import org.kuali.student.common.ui.client.widgets.notification.KSNotifier; |
50 | |
import org.kuali.student.common.ui.client.widgets.progress.BlockingTask; |
51 | |
import org.kuali.student.common.ui.client.widgets.progress.KSBlockingProgressIndicator; |
52 | |
import org.kuali.student.common.ui.client.widgets.table.summary.SummaryTableSection; |
53 | |
import org.kuali.student.common.ui.shared.IdAttributes.IdType; |
54 | |
import org.kuali.student.core.statement.dto.StatementTypeInfo; |
55 | |
import org.kuali.student.lum.common.client.helpers.RecentlyViewedHelper; |
56 | |
import org.kuali.student.lum.common.client.lu.LUUIPermissions; |
57 | |
import org.kuali.student.lum.lu.ui.course.client.configuration.CourseProposalConfigurer; |
58 | |
import org.kuali.student.lum.lu.ui.course.client.configuration.ViewCourseConfigurer; |
59 | |
import org.kuali.student.lum.lu.ui.course.client.configuration.ViewCourseConfigurer.ViewCourseSections; |
60 | |
import org.kuali.student.lum.lu.ui.course.client.requirements.CourseRequirementsDataModel; |
61 | |
import org.kuali.student.lum.lu.ui.course.client.requirements.HasRequirements; |
62 | |
import org.kuali.student.lum.lu.ui.course.client.service.CourseRpcService; |
63 | |
import org.kuali.student.lum.lu.ui.course.client.service.CourseRpcServiceAsync; |
64 | |
import org.kuali.student.lum.lu.ui.course.client.widgets.CourseWorkflowActionList; |
65 | |
|
66 | |
import com.google.gwt.core.client.GWT; |
67 | |
import com.google.gwt.event.dom.client.ClickEvent; |
68 | |
import com.google.gwt.event.dom.client.ClickHandler; |
69 | |
import com.google.gwt.event.logical.shared.CloseEvent; |
70 | |
import com.google.gwt.event.logical.shared.CloseHandler; |
71 | |
import com.google.gwt.user.client.Window; |
72 | |
import com.google.gwt.user.client.ui.ComplexPanel; |
73 | |
import com.google.gwt.user.client.ui.Widget; |
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | |
|
81 | 0 | public class ViewCourseController extends TabMenuController implements DocumentLayoutController, HasRequirements, RequiresAuthorization{ |
82 | 0 | private final DataModel cluModel = new DataModel(); |
83 | |
|
84 | |
private WorkQueue modelRequestQueue; |
85 | |
|
86 | 0 | private String cluType = "kuali.lu.type.CreditCourse"; |
87 | 0 | private String courseId = null; |
88 | |
|
89 | |
private static final String CLU_STATE = DtoConstants.STATE_ACTIVE; |
90 | |
private static final String MSG_GROUP = "course"; |
91 | |
|
92 | 0 | private final String REFERENCE_TYPE = "referenceType.clu"; |
93 | 0 | private boolean initialized = false; |
94 | 0 | CourseRpcServiceAsync rpcServiceAsync = GWT.create(CourseRpcService.class); |
95 | |
|
96 | 0 | private final BlockingTask loadDataTask = new BlockingTask("Retrieving Data...."); |
97 | 0 | private final BlockingTask initTask = new BlockingTask("Initializing...."); |
98 | 0 | private final KSLabel statusLabel = new KSLabel(""); |
99 | |
|
100 | 0 | private final List<CourseWorkflowActionList> actionDropDownWidgets = new ArrayList<CourseWorkflowActionList>(); |
101 | |
|
102 | |
private final CourseRequirementsDataModel reqDataModel; |
103 | |
|
104 | 0 | final ViewCourseConfigurer cfg = GWT.create(ViewCourseConfigurer.class); |
105 | |
|
106 | |
public ViewCourseController(Enum<?> viewType){ |
107 | 0 | super(CourseProposalController.class.getName()); |
108 | 0 | initialize(); |
109 | 0 | addStyleName("courseView"); |
110 | 0 | reqDataModel = new CourseRequirementsDataModel(this); |
111 | 0 | this.tabPanel.addStyleName("standard-content-padding"); |
112 | 0 | this.setViewEnum(viewType); |
113 | 0 | } |
114 | |
|
115 | |
@Override |
116 | |
public void setViewContext(ViewContext viewContext) { |
117 | 0 | super.setViewContext(viewContext); |
118 | 0 | if(viewContext.getId() != null && !viewContext.getId().isEmpty()){ |
119 | 0 | viewContext.setPermissionType(PermissionType.OPEN); |
120 | 0 | this.setCourseId(viewContext.getId()); |
121 | |
} |
122 | 0 | } |
123 | |
|
124 | |
private void initialize() { |
125 | 0 | super.setDefaultModelId(CourseProposalConfigurer.COURSE_PROPOSAL_MODEL); |
126 | 0 | super.registerModel(CourseProposalConfigurer.COURSE_PROPOSAL_MODEL, new ModelProvider<DataModel>() { |
127 | |
|
128 | |
@Override |
129 | |
public void requestModel(final ModelRequestCallback<DataModel> callback) { |
130 | 0 | if (modelRequestQueue == null){ |
131 | 0 | modelRequestQueue = new WorkQueue(); |
132 | |
} |
133 | |
|
134 | 0 | WorkItem workItem = new WorkItem(){ |
135 | |
@Override |
136 | |
public void exec(Callback<Boolean> workCompleteCallback) { |
137 | 0 | if (cluModel.getRoot() == null || cluModel.getRoot().size() == 0){ |
138 | 0 | if (courseId != null){ |
139 | 0 | getCourseFromCluId(callback, workCompleteCallback); |
140 | |
} else{ |
141 | 0 | createNewCluModel(callback, workCompleteCallback); |
142 | |
} |
143 | |
} else { |
144 | 0 | callback.onModelReady(cluModel); |
145 | 0 | workCompleteCallback.exec(true); |
146 | |
} |
147 | 0 | } |
148 | |
}; |
149 | 0 | modelRequestQueue.submit(workItem); |
150 | |
|
151 | 0 | } |
152 | |
|
153 | |
}); |
154 | 0 | } |
155 | |
|
156 | |
public Widget generateActionDropDown(){ |
157 | 0 | CourseWorkflowActionList actionList = new CourseWorkflowActionList(this.getMessage("cluActionsLabel"), getViewContext(), "/HOME/CURRICULUM_HOME/COURSE_PROPOSAL", cluModel, new Callback<String>() { |
158 | |
@Override |
159 | |
public void exec(String newState) { |
160 | 0 | if (newState != null) { |
161 | 0 | KSNotifier.add(new KSNotification(getMessage("cluStateChangeNotification" + newState), false, 5000)); |
162 | |
|
163 | 0 | statusLabel.setText("Course Status: " + newState); |
164 | |
} else { |
165 | 0 | KSNotifier.add(new KSNotification(getMessage("cluStateChangeFailedNotification"), false, 5000)); |
166 | |
} |
167 | 0 | } |
168 | |
}); |
169 | 0 | actionDropDownWidgets.add(actionList); |
170 | |
|
171 | 0 | return actionList; |
172 | |
} |
173 | |
|
174 | |
private void init(final Callback<Boolean> onReadyCallback) { |
175 | |
|
176 | 0 | if (initialized) { |
177 | 0 | onReadyCallback.exec(true); |
178 | |
} else { |
179 | 0 | KSBlockingProgressIndicator.addTask(initTask); |
180 | 0 | this.setContentTitle("View Course"); |
181 | 0 | this.setName("Course"); |
182 | 0 | String idType = null; |
183 | 0 | String viewContextId = null; |
184 | |
|
185 | |
|
186 | 0 | if(getViewContext().getIdType() != null){ |
187 | 0 | idType = getViewContext().getIdType().toString(); |
188 | 0 | viewContextId = getViewContext().getId(); |
189 | 0 | if(getViewContext().getIdType()==IdType.COPY_OF_OBJECT_ID){ |
190 | 0 | viewContextId = null; |
191 | |
} |
192 | |
|
193 | |
} |
194 | |
|
195 | 0 | rpcServiceAsync.getMetadata("", null, new KSAsyncCallback<Metadata>(){ |
196 | |
|
197 | |
@Override |
198 | |
public void handleFailure(Throwable caught) { |
199 | 0 | initialized = false; |
200 | 0 | onReadyCallback.exec(false); |
201 | 0 | KSBlockingProgressIndicator.removeTask(initTask); |
202 | 0 | throw new RuntimeException("Failed to get model definition.", caught); |
203 | |
} |
204 | |
|
205 | |
public void onSuccess(Metadata result) { |
206 | 0 | DataModelDefinition def = new DataModelDefinition(result); |
207 | 0 | cluModel.setDefinition(def); |
208 | 0 | init(def, onReadyCallback); |
209 | 0 | } |
210 | |
}); |
211 | |
|
212 | |
} |
213 | 0 | } |
214 | |
|
215 | |
private void updateCourseActionItems() { |
216 | |
|
217 | 0 | for(CourseWorkflowActionList widget: actionDropDownWidgets){ |
218 | 0 | widget.updateCourseActionItems(cluModel); |
219 | |
} |
220 | 0 | } |
221 | |
|
222 | |
private void init(final DataModelDefinition modelDefinition, final Callback<Boolean> onReadyCallback){ |
223 | |
|
224 | 0 | CourseRequirementsDataModel.getStatementTypes(new Callback<List<StatementTypeInfo>>() { |
225 | |
|
226 | |
@Override |
227 | |
public void exec(List<StatementTypeInfo> stmtTypes) { |
228 | 0 | List<StatementTypeInfo> stmtTypesOut = new ArrayList<StatementTypeInfo>(); |
229 | 0 | if (stmtTypes != null) { |
230 | 0 | for (StatementTypeInfo stmtType : stmtTypes) { |
231 | 0 | if (stmtType.getId().contains("kuali.statement.type.course.enrollmentEligibility") || |
232 | |
stmtType.getId().contains("kuali.statement.type.course.creditConstraints")) { |
233 | 0 | continue; |
234 | |
} |
235 | 0 | stmtTypesOut.add(stmtType); |
236 | |
} |
237 | |
} |
238 | 0 | if(!initialized){ |
239 | 0 | initialized = true; |
240 | 0 | cfg.setStatementTypes(stmtTypesOut); |
241 | 0 | cfg.setModelDefinition(modelDefinition); |
242 | 0 | cfg.generateLayout(ViewCourseController.this); |
243 | |
} |
244 | 0 | onReadyCallback.exec(true); |
245 | 0 | KSBlockingProgressIndicator.removeTask(initTask); |
246 | 0 | } |
247 | |
}); |
248 | 0 | } |
249 | |
|
250 | |
@SuppressWarnings("unchecked") |
251 | |
@Override |
252 | |
public void requestModel(Class modelType, final ModelRequestCallback callback) { |
253 | 0 | if(modelType == ReferenceModel.class){ |
254 | 0 | if (cluModel != null){ |
255 | 0 | ReferenceModel ref = new ReferenceModel(); |
256 | |
|
257 | 0 | if(cluModel.get("course/id") != null){ |
258 | 0 | ref.setReferenceId((String)cluModel.get("course/id")); |
259 | |
} else{ |
260 | 0 | ref.setReferenceId(null); |
261 | |
} |
262 | |
|
263 | 0 | ref.setReferenceTypeKey(REFERENCE_TYPE); |
264 | 0 | ref.setReferenceType(cluType); |
265 | 0 | ref.setReferenceState(CLU_STATE); |
266 | |
|
267 | 0 | callback.onModelReady(ref); |
268 | 0 | } |
269 | 0 | }else if (modelType == Data.class){ |
270 | 0 | requestModel(CourseProposalConfigurer.COURSE_PROPOSAL_MODEL, callback); |
271 | |
} else { |
272 | 0 | super.requestModel(modelType, callback); |
273 | |
} |
274 | 0 | } |
275 | |
|
276 | |
@SuppressWarnings("unchecked") |
277 | |
private void getCourseFromCluId(final ModelRequestCallback callback, final Callback<Boolean> workCompleteCallback){ |
278 | 0 | KSBlockingProgressIndicator.addTask(loadDataTask); |
279 | |
|
280 | 0 | rpcServiceAsync.getData(courseId, new KSAsyncCallback<Data>(){ |
281 | |
|
282 | |
@Override |
283 | |
public void handleFailure(Throwable caught) { |
284 | 0 | Window.alert("Error loading Course: "+caught.getMessage()); |
285 | 0 | createNewCluModel(callback, workCompleteCallback); |
286 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
287 | 0 | } |
288 | |
|
289 | |
@Override |
290 | |
public void onSuccess(Data result) { |
291 | 0 | cluModel.setRoot(result); |
292 | |
|
293 | 0 | setHeaderTitle(); |
294 | 0 | updateCourseActionItems(); |
295 | 0 | callback.onModelReady(cluModel); |
296 | 0 | workCompleteCallback.exec(true); |
297 | 0 | reqDataModel.retrieveStatementTypes(cluModel.<String>get("id"), new Callback<Boolean>() { |
298 | |
@Override |
299 | |
public void exec(Boolean result) { |
300 | 0 | if (result) { |
301 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
302 | |
} |
303 | 0 | } |
304 | |
}); |
305 | |
|
306 | 0 | } |
307 | |
|
308 | |
}); |
309 | 0 | } |
310 | |
|
311 | |
@SuppressWarnings("unchecked") |
312 | |
private void getCurrentVersion(final ModelRequestCallback callback, final Callback<Boolean> workCompleteCallback) { |
313 | 0 | rpcServiceAsync.getData(courseId, new KSAsyncCallback<Data>(){ |
314 | |
|
315 | |
@Override |
316 | |
public void handleFailure(Throwable caught) { |
317 | 0 | Window.alert("Error loading Course: "+caught.getMessage()); |
318 | 0 | createNewCluModel(callback, workCompleteCallback); |
319 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
320 | 0 | } |
321 | |
|
322 | |
@Override |
323 | |
public void onSuccess(Data result) { |
324 | 0 | cluModel.setRoot(result); |
325 | |
|
326 | 0 | setHeaderTitle(); |
327 | 0 | updateCourseActionItems(); |
328 | 0 | callback.onModelReady(cluModel); |
329 | 0 | workCompleteCallback.exec(true); |
330 | 0 | KSBlockingProgressIndicator.removeTask(loadDataTask); |
331 | 0 | } |
332 | |
|
333 | |
}); |
334 | 0 | } |
335 | |
|
336 | |
@SuppressWarnings("unchecked") |
337 | |
private void createNewCluModel(final ModelRequestCallback callback, final Callback<Boolean> workCompleteCallback){ |
338 | 0 | cluModel.setRoot(new Data()); |
339 | 0 | callback.onModelReady(cluModel); |
340 | 0 | workCompleteCallback.exec(true); |
341 | 0 | } |
342 | |
|
343 | |
public String getCourseId() { |
344 | 0 | return courseId; |
345 | |
} |
346 | |
|
347 | |
public String getVersionIndId() { |
348 | 0 | return (String)cluModel.get("versionInfo/versionIndId"); |
349 | |
} |
350 | |
|
351 | |
public void setCourseId(String courseId) { |
352 | 0 | this.courseId = courseId; |
353 | 0 | this.cluModel.setRoot(new Data()); |
354 | 0 | } |
355 | |
|
356 | |
public void clear(String cluType){ |
357 | 0 | super.clear(); |
358 | 0 | this.cluType = cluType; |
359 | 0 | if (cluModel != null){ |
360 | 0 | this.cluModel.setRoot(new Data()); |
361 | |
} |
362 | 0 | this.courseId = null; |
363 | 0 | } |
364 | |
|
365 | |
@Override |
366 | |
public void showDefaultView(final Callback<Boolean> onReadyCallback) { |
367 | 0 | init(new Callback<Boolean>() { |
368 | |
|
369 | |
@Override |
370 | |
public void exec(Boolean result) { |
371 | 0 | if (result) { |
372 | 0 | ViewCourseController.super.showDefaultView(onReadyCallback); |
373 | |
} else { |
374 | 0 | onReadyCallback.exec(false); |
375 | |
} |
376 | 0 | } |
377 | |
}); |
378 | 0 | } |
379 | |
|
380 | |
@Override |
381 | |
public void beforeShow(Callback<Boolean> onReadyCallback) { |
382 | 0 | showDefaultView(onReadyCallback); |
383 | 0 | } |
384 | |
|
385 | |
private KSButton getQuitButton(){ |
386 | 0 | return new KSButton("Quit", new ClickHandler(){ |
387 | |
public void onClick(ClickEvent event) { |
388 | 0 | Application.navigate("/HOME/CURRICULUM_HOME"); |
389 | 0 | } |
390 | |
}); |
391 | |
} |
392 | |
|
393 | |
|
394 | |
protected void setHeaderTitle() { |
395 | |
|
396 | |
String title; |
397 | 0 | if (cluModel.get("transcriptTitle") != null){ |
398 | 0 | title = getCourseTitle(); |
399 | |
} |
400 | |
else{ |
401 | 0 | title = "Course"; |
402 | |
} |
403 | |
|
404 | 0 | updateStatus(); |
405 | |
|
406 | 0 | this.setContentTitle(title); |
407 | 0 | this.setName(title); |
408 | 0 | WindowTitleUtils.setContextTitle(title); |
409 | 0 | } |
410 | |
|
411 | |
private void updateStatus() { |
412 | 0 | if(cluModel.get("state") != null){ |
413 | 0 | statusLabel.setText(getMessage("courseStatusLabel") + ": " + cluModel.get("state")); |
414 | |
} |
415 | 0 | } |
416 | |
|
417 | |
private CloseHandler<KSLightBox> createActionSubmitSuccessHandler() { |
418 | 0 | CloseHandler<KSLightBox> handler = new CloseHandler<KSLightBox>(){ |
419 | |
@Override |
420 | |
public void onClose(CloseEvent<KSLightBox> event) { |
421 | |
|
422 | 0 | Window.Location.reload(); |
423 | 0 | } |
424 | |
}; |
425 | 0 | return handler; |
426 | |
} |
427 | |
|
428 | |
public String getMessage(String courseMessageKey) { |
429 | 0 | String msg = Application.getApplicationContext().getMessage(MSG_GROUP, courseMessageKey); |
430 | 0 | if (msg == null) { |
431 | 0 | msg = courseMessageKey; |
432 | |
} |
433 | 0 | return msg; |
434 | |
} |
435 | |
|
436 | |
public Widget getStatusLabel() { |
437 | 0 | statusLabel.setStyleName("courseStatusLabel"); |
438 | 0 | return statusLabel; |
439 | |
} |
440 | |
|
441 | |
public Widget getVersionHistoryWidget(){ |
442 | 0 | KSButton button = new KSButton("Version History", ButtonStyle.DEFAULT_ANCHOR, new ClickHandler(){ |
443 | |
|
444 | |
@Override |
445 | |
public void onClick(ClickEvent event) { |
446 | 0 | parentController.showView(ViewCourseParentController.Views.VERSIONS); |
447 | 0 | } |
448 | |
}); |
449 | 0 | button.addStyleName("versionHistoryLink"); |
450 | 0 | return button; |
451 | |
|
452 | |
} |
453 | |
|
454 | |
@Override |
455 | |
public void onHistoryEvent(String historyStack) { |
456 | 0 | super.onHistoryEvent(historyStack); |
457 | 0 | if (cluModel.get("courseTitle") != null){ |
458 | 0 | RecentlyViewedHelper.addCurrentDocument(getCourseTitle()); |
459 | |
} |
460 | 0 | } |
461 | |
|
462 | |
public String getCourseTitle(){ |
463 | 0 | return cluModel.get("courseTitle"); |
464 | |
} |
465 | |
|
466 | |
|
467 | |
public String getCurrentId() { |
468 | 0 | return cluModel.get("id"); |
469 | |
} |
470 | |
|
471 | |
@Override |
472 | |
public CourseRequirementsDataModel getReqDataModel() { |
473 | 0 | return reqDataModel; |
474 | |
} |
475 | |
|
476 | |
@Override |
477 | |
public DataModel getExportDataModel() { |
478 | 0 | return cluModel; |
479 | |
} |
480 | |
|
481 | |
@Override |
482 | |
public boolean isExportButtonActive() { |
483 | 0 | return true; |
484 | |
} |
485 | |
|
486 | |
@Override |
487 | |
public List<ExportElement> getExportElementsFromView() { |
488 | 0 | List<ExportElement> exportElements = new ArrayList<ExportElement>(); |
489 | 0 | ExportElement heading = new ExportElement(); |
490 | 0 | heading.setFieldLabel(""); |
491 | 0 | heading.setFieldValue(this.tabPanel.getSelectedTabName()); |
492 | 0 | exportElements.add(heading); |
493 | 0 | if (this.getCurrentViewEnum() != null) { |
494 | 0 | if (this.getCurrentViewEnum().equals(ViewCourseSections.DETAILED)) { |
495 | 0 | exportElements.addAll(ExportUtils.getDetailsForWidget(this.tabPanel.getSelectedTab(), "", "").get(0).getSubset()); |
496 | 0 | } else if (this.getCurrentViewEnum().equals(ViewCourseSections.BRIEF)){ |
497 | 0 | exportElements.addAll(ExportUtils.getDetailsForWidget(this.tabPanel.getSelectedTab(), "", "").get(0).getSubset()); |
498 | 0 | } else if (this.getCurrentViewEnum().equals(ViewCourseSections.CATALOG)){ |
499 | 0 | exportElements.addAll(ExportUtils.getDetailsForWidget(this.tabPanel.getSelectedTab(), "", "")); |
500 | |
} |
501 | |
} |
502 | 0 | return exportElements; |
503 | |
} |
504 | |
|
505 | |
@Override |
506 | |
public boolean isAuthorizationRequired() { |
507 | 0 | return true; |
508 | |
} |
509 | |
|
510 | |
@Override |
511 | |
public void setAuthorizationRequired(boolean required) { |
512 | 0 | throw new UnsupportedOperationException(); |
513 | |
} |
514 | |
|
515 | |
@Override |
516 | |
public void checkAuthorization(final AuthorizationCallback authCallback) { |
517 | 0 | Application.getApplicationContext().getSecurityContext().checkScreenPermission(LUUIPermissions.USE_FIND_COURSE_SCREEN, new Callback<Boolean>() { |
518 | |
@Override |
519 | |
public void exec(Boolean result) { |
520 | |
|
521 | 0 | final boolean isAuthorized = result; |
522 | |
|
523 | 0 | if(isAuthorized){ |
524 | 0 | authCallback.isAuthorized(); |
525 | |
} |
526 | |
else |
527 | 0 | authCallback.isNotAuthorized("User is not authorized: " + LUUIPermissions.USE_FIND_COURSE_SCREEN); |
528 | 0 | } |
529 | |
}); |
530 | 0 | } |
531 | |
} |