|
@@ -0,0 +1,29 @@
|
|
|
+package cn.iselab.mooctest.site.Factory;
|
|
|
+
|
|
|
+
|
|
|
+import cn.iselab.mooctest.site.Strategy.*;
|
|
|
+
|
|
|
+public class PermissionStrategyFactory {
|
|
|
+
|
|
|
+
|
|
|
+ public static PermissionGetStrategy getStrategy(String resource) throws Exception {
|
|
|
+ if ("app".equals(resource)) {
|
|
|
+ return new appStrategy();
|
|
|
+ } else if ("case".equals(resource)) {
|
|
|
+ return new CaseStrategy();
|
|
|
+ } else if ("group".equals(resource)) {
|
|
|
+ return new GroupStrategy();
|
|
|
+ } else if ("paper".equals(resource)) {
|
|
|
+ return new PaperStrategy();
|
|
|
+ } else if ("report".equals(resource)) {
|
|
|
+ return new ReportStrategy();
|
|
|
+ } else if ("task".equals(resource)) {
|
|
|
+ return new ExamStrategy();
|
|
|
+ } else {
|
|
|
+ throw new Exception("informal resource format");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|