From ca45a37fef990099f2becab5fc610a1192ebbab8 Mon Sep 17 00:00:00 2001 From: zhai_lw Date: Wed, 9 Jan 2019 22:08:40 +0800 Subject: [PATCH] =?UTF-8?q?1,=20process=20=E8=B0=83=E6=95=B4=E4=B8=BA3?= =?UTF-8?q?=E7=B1=BB=202=EF=BC=8C=E5=AE=8C=E5=96=84Exception?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/misc.xml | 2 +- GDMS.iml | 4 +- src/core/operation/Operation.java | 3 +- src/core/operation/Select.java | 3 +- src/core/operation/UploadFileOperation.java | 8 +++ src/core/process/AtomProcess.java | 28 -------- src/core/process/AuxiliaryProcess.java | 7 ++ src/core/process/Condition.java | 4 ++ src/core/process/LastProcess.java | 4 +- src/core/process/Process.java | 68 ++++++++++++++++++- src/core/process/ProcessManagement.java | 14 ++-- src/core/process/TemporaryProcess.java | 9 +++ .../{studentProcess.json => process.json} | 0 src/core/process/teacherProcess.json | 3 - src/core/user/User.java | 9 +++ src/core/user/utils/AccountManagement.java | 2 +- src/error/GExcptFactory.java | 7 ++ src/servlet/login.java | 22 ------ web/WEB-INF/web.xml | 8 +++ web/webPage/jsFile/login.js | 1 - 20 files changed, 134 insertions(+), 72 deletions(-) delete mode 100644 src/core/process/AtomProcess.java create mode 100644 src/core/process/AuxiliaryProcess.java create mode 100644 src/core/process/TemporaryProcess.java rename src/core/process/{studentProcess.json => process.json} (100%) delete mode 100644 src/core/process/teacherProcess.json create mode 100644 src/error/GExcptFactory.java delete mode 100644 src/servlet/login.java diff --git a/.idea/misc.xml b/.idea/misc.xml index 35bdbab..11bca97 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/GDMS.iml b/GDMS.iml index 9457690..0ccb429 100644 --- a/GDMS.iml +++ b/GDMS.iml @@ -19,11 +19,11 @@ - + - + diff --git a/src/core/operation/Operation.java b/src/core/operation/Operation.java index 74984bc..195dbfa 100644 --- a/src/core/operation/Operation.java +++ b/src/core/operation/Operation.java @@ -2,6 +2,7 @@ package core.operation; import core.user.User; +import error.GExcptSQL; import gdms.Mode; import java.util.Map; @@ -37,6 +38,6 @@ public abstract class Operation { } this.options.put(key,value); } - public abstract void execute(User subject); + public abstract void execute(User subject) throws GExcptSQL; } diff --git a/src/core/operation/Select.java b/src/core/operation/Select.java index 838308a..3ea81dd 100644 --- a/src/core/operation/Select.java +++ b/src/core/operation/Select.java @@ -2,6 +2,7 @@ package core.operation; import core.user.User; import dao.DBManagement; +import error.GExcptSQL; import java.util.Map; @@ -10,7 +11,7 @@ public class Select extends Operation { private Map options; private User subject; @Override - public void execute(User subject) { + public void execute(User subject) throws GExcptSQL { this.setSubject(subject); DBManagement.update("update stu "); } diff --git a/src/core/operation/UploadFileOperation.java b/src/core/operation/UploadFileOperation.java index 307b964..746621f 100644 --- a/src/core/operation/UploadFileOperation.java +++ b/src/core/operation/UploadFileOperation.java @@ -1,7 +1,15 @@ package core.operation; +import core.user.User; +import error.GExcptSQL; + import java.util.Map; public class UploadFileOperation extends Operation { Map options; + + @Override + public void execute(User subject) throws GExcptSQL { + + } } diff --git a/src/core/process/AtomProcess.java b/src/core/process/AtomProcess.java deleted file mode 100644 index 777dfe1..0000000 --- a/src/core/process/AtomProcess.java +++ /dev/null @@ -1,28 +0,0 @@ -package core.process; - -import core.operation.Operation; -import core.user.User; - - -public class AtomProcess extends Process { - private String permission; - private Operation operation; - private String ButtonName; - private String info; - private String processOptions; - - public AtomProcess(String permission, String operationName, String processOptions, String info) throws Exception { - super(info); - this.permission = permission; - this.operation = (Operation) core.utils.GetObjectByName.getOperationByName(operationName); - this.info = info; - this.processOptions = processOptions; - operation.setProcessOperations(processOptions); - } - public void setUserOperations(String key,Object value){ - this.operation.addUserOperations(key,value); - } - public void execute(User subject){ - this.operation.execute(subject); - } -} diff --git a/src/core/process/AuxiliaryProcess.java b/src/core/process/AuxiliaryProcess.java new file mode 100644 index 0000000..526c5fc --- /dev/null +++ b/src/core/process/AuxiliaryProcess.java @@ -0,0 +1,7 @@ +package core.process; + +public class AuxiliaryProcess extends Process { + public AuxiliaryProcess(String permission, String operationName, String processOptions, String info) throws Exception { + super(permission, operationName, processOptions, info); + } +} diff --git a/src/core/process/Condition.java b/src/core/process/Condition.java index 4d62665..9365dbb 100644 --- a/src/core/process/Condition.java +++ b/src/core/process/Condition.java @@ -4,6 +4,10 @@ import java.util.ArrayList; import java.util.List; public class Condition { + public List getProcesses() { + return processes; + } + private List processes; public Process get(int index){ return processes.get(index); diff --git a/src/core/process/LastProcess.java b/src/core/process/LastProcess.java index 316e405..4c48117 100644 --- a/src/core/process/LastProcess.java +++ b/src/core/process/LastProcess.java @@ -2,7 +2,7 @@ package core.process; public class LastProcess extends Process{ - public LastProcess(String info) { - super(info); + public LastProcess(String permission, String operationName, String processOptions, String info) throws Exception { + super(permission, operationName, processOptions, info); } } diff --git a/src/core/process/Process.java b/src/core/process/Process.java index 564334d..966aa17 100644 --- a/src/core/process/Process.java +++ b/src/core/process/Process.java @@ -1,13 +1,75 @@ package core.process; +import core.operation.Operation; +import core.user.User; +import error.GExcptFactory; +import error.GExcptSQL; + public abstract class Process { + + private String permission; + private Operation operation; + private String buttonName; private String info; + private String processOptions; + + public Process(String permission, String operationName, String processOptions, String info) throws Exception { + super(); + this.setPermission(permission); + this.setOperation(operationName); + this.setInfo(info); + this.setProcessOptions(processOptions); + operation.setProcessOperations(processOptions); + } - public Process(String info) { - this.info=info; + public void setUserOperations(String key,Object value){ + this.operation.addUserOperations(key,value); + } + public void execute(User subject) throws GExcptSQL { + this.operation.execute(subject); + } + private void setOperation(String operationName) throws GExcptFactory { + try { + this.operation = (Operation) core.utils.GetObjectByName.getOperationByName(operationName); + } catch (Exception e) { + throw new GExcptFactory("create"+operationName+"failure"); + } } - public String getInfo() { + public void setInfo(String info) { + this.info = info; + } + public String getButtonName() { + return buttonName; + } + public void setButtonName(String buttonName) { + this.buttonName = buttonName; + } + public String getInfo() { return info; } + public String getPermission() { + return permission; + } + + public void setPermission(String permission) { + this.permission = permission; + } + + public Operation getOperation() { + return operation; + } + + public void setOperation(Operation operation) { + this.operation = operation; + } + + public String getProcessOptions() { + return processOptions; + } + + public void setProcessOptions(String processOptions) { + this.processOptions = processOptions; + } + } diff --git a/src/core/process/ProcessManagement.java b/src/core/process/ProcessManagement.java index dbffd13..7223a47 100644 --- a/src/core/process/ProcessManagement.java +++ b/src/core/process/ProcessManagement.java @@ -1,23 +1,23 @@ package core.process; import java.io.File; -import java.util.ArrayList; import java.util.List; import java.util.Map; public class ProcessManagement { - private List processes; - private Map> lastProcesses; + private List temporaryProcesses; + private Map> lastProcesses; + private List auxiliaryProcesses; public void setProcessesByJson(File file){ //todo } - public Process getAtomProcess(int index){ - return processes.get(index); + public Process getTemporaryProcess(int index){ + return temporaryProcesses.get(index); } public Condition getCondition(String userType, List index){ - Condition condition = new Condition(lastProcesses.get(userType)); + Condition condition = new Condition(this.lastProcesses.get(userType)); for(int i:index){ - condition.add(getAtomProcess(i)); + condition.add(getTemporaryProcess(i)); } return condition; } diff --git a/src/core/process/TemporaryProcess.java b/src/core/process/TemporaryProcess.java new file mode 100644 index 0000000..3f22949 --- /dev/null +++ b/src/core/process/TemporaryProcess.java @@ -0,0 +1,9 @@ +package core.process; + + + +public class TemporaryProcess extends Process { + public TemporaryProcess(String permission, String operationName, String processOptions, String info) throws Exception { + super(permission, operationName, processOptions, info); + } +} diff --git a/src/core/process/studentProcess.json b/src/core/process/process.json similarity index 100% rename from src/core/process/studentProcess.json rename to src/core/process/process.json diff --git a/src/core/process/teacherProcess.json b/src/core/process/teacherProcess.json deleted file mode 100644 index 0e0dcd2..0000000 --- a/src/core/process/teacherProcess.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - -} \ No newline at end of file diff --git a/src/core/user/User.java b/src/core/user/User.java index 0f81d10..8048293 100644 --- a/src/core/user/User.java +++ b/src/core/user/User.java @@ -11,6 +11,15 @@ public abstract class User implements AccountManageable, ProcessConfigurable{ private String id; private String password; private List permissions = null; + + public Condition getCondition() { + return condition; + } + + public void setCondition(Condition condition) { + this.condition = condition; + } + private Condition condition; public void addPermission(String permission){ if(!permissions.contains(permission)) diff --git a/src/core/user/utils/AccountManagement.java b/src/core/user/utils/AccountManagement.java index 489c04a..8c8df7a 100644 --- a/src/core/user/utils/AccountManagement.java +++ b/src/core/user/utils/AccountManagement.java @@ -5,7 +5,7 @@ import core.user.User; import java.util.List; public interface AccountManagement { - static User login(String id, String password, String User){ + static User login(String id, String password){ //todo return null; } diff --git a/src/error/GExcptFactory.java b/src/error/GExcptFactory.java new file mode 100644 index 0000000..60c7d6d --- /dev/null +++ b/src/error/GExcptFactory.java @@ -0,0 +1,7 @@ +package error; + +public class GExcptFactory extends GExcpt { + public GExcptFactory(String info) { + super(info); + } +} diff --git a/src/servlet/login.java b/src/servlet/login.java deleted file mode 100644 index 11650f2..0000000 --- a/src/servlet/login.java +++ /dev/null @@ -1,22 +0,0 @@ -package servlet; - -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -@WebServlet(name = "login") -public class login extends HttpServlet { - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - - } - - protected void doGet(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - - } -} diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml index 95ec93c..37a5f89 100644 --- a/web/WEB-INF/web.xml +++ b/web/WEB-INF/web.xml @@ -16,4 +16,12 @@ default *.jpg + + default + *.css + + + default + *.js + \ No newline at end of file diff --git a/web/webPage/jsFile/login.js b/web/webPage/jsFile/login.js index 79982cf..ed3803f 100644 --- a/web/webPage/jsFile/login.js +++ b/web/webPage/jsFile/login.js @@ -23,6 +23,5 @@ $(document).ready( function () { $('.to-register').on('click', showRegister); $('.to-login').on('click', showlogin); - $('.submit-style').on('click',) })