1 | |
package org.kuali.student.lum.lu.ui.course.client.views; |
2 | |
|
3 | |
import java.util.HashMap; |
4 | |
import java.util.Map; |
5 | |
|
6 | |
import org.kuali.student.common.ui.client.application.KSAsyncCallback; |
7 | |
import org.kuali.student.common.ui.client.mvc.Controller; |
8 | |
import org.kuali.student.common.ui.client.mvc.ViewComposite; |
9 | |
import org.kuali.student.common.ui.client.service.MetadataRpcService; |
10 | |
import org.kuali.student.common.ui.client.service.MetadataRpcServiceAsync; |
11 | |
import org.kuali.student.common.ui.client.widgets.field.layout.element.SpanPanel; |
12 | |
import org.kuali.student.core.assembly.data.Metadata; |
13 | |
import org.kuali.student.core.rice.authorization.PermissionType; |
14 | |
import org.kuali.student.lum.lu.ui.course.client.service.CreditCourseProposalRpcService; |
15 | |
import org.kuali.student.lum.lu.ui.course.client.service.CreditCourseProposalRpcServiceAsync; |
16 | |
import org.kuali.student.lum.lu.ui.main.client.configuration.CurriculumHomeConfigurer; |
17 | |
|
18 | |
import com.google.gwt.core.client.GWT; |
19 | |
import org.kuali.student.common.ui.client.widgets.KSErrorDialog; |
20 | |
|
21 | 0 | public class CurriculumHomeView extends ViewComposite{ |
22 | |
|
23 | 0 | private final SpanPanel container = new SpanPanel(); |
24 | 0 | MetadataRpcServiceAsync metadataServiceAsync = GWT.create(MetadataRpcService.class); |
25 | 0 | CreditCourseProposalRpcServiceAsync cluProposalRpcServiceAsync = GWT.create(CreditCourseProposalRpcService.class); |
26 | 0 | CurriculumHomeConfigurer configurer = GWT.create(CurriculumHomeConfigurer.class); |
27 | |
|
28 | |
public CurriculumHomeView(Controller controller, Enum<?> viewType) { |
29 | 0 | super(controller, "", viewType); |
30 | 0 | this.initWidget(container); |
31 | 0 | setup(); |
32 | 0 | } |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
protected void setup(){ |
58 | 0 | metadataServiceAsync.getMetadata("search", null, null, new KSAsyncCallback<Metadata>() { |
59 | |
@Override |
60 | |
public void handleFailure(Throwable caught) { |
61 | 0 | container.add(configurer.configure(null)); |
62 | |
|
63 | 0 | throw new RuntimeException("Could not retreive metadata: " + caught.getMessage(), caught); |
64 | |
} |
65 | |
@Override |
66 | |
public void onSuccess(Metadata metadata) { |
67 | |
|
68 | |
|
69 | |
|
70 | 0 | container.add(configurer.configure(metadata)); |
71 | 0 | } |
72 | |
}); |
73 | 0 | } |
74 | |
|
75 | |
|
76 | |
@Deprecated |
77 | |
private void addIfPermitted(PermissionType permType, String searchType) { |
78 | 0 | addIfPermitted(permType, searchType, new HashMap<String,String>()); |
79 | 0 | } |
80 | |
|
81 | |
@Deprecated |
82 | |
private void addIfPermitted(PermissionType permType, final String searchType, Map<String,String> permissionAttributes) { |
83 | 0 | cluProposalRpcServiceAsync.isAuthorized(permType, permissionAttributes, new KSAsyncCallback<Boolean>() { |
84 | |
@Override |
85 | |
public void handleFailure(Throwable caught) { |
86 | 0 | throw new RuntimeException("Could not verify authorization: " + caught.getMessage(), caught); |
87 | |
} |
88 | |
@Override |
89 | |
public void onSuccess(Boolean result) { |
90 | |
|
91 | 0 | if(result) { |
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | |
|
99 | |
} |
100 | 0 | } |
101 | |
}); |
102 | 0 | } |
103 | |
|
104 | |
|
105 | |
} |