1, process 调整为3类

2,完善Exception
wlf
zhai_lw 6 years ago
parent b5f2321f76
commit ca45a37fef

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_10" default="false" project-jdk-name="11" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_10" default="false" project-jdk-name="10" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -19,11 +19,11 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Tomcat 8.5" level="application_server_libraries" />
<orderEntry type="library" scope="PROVIDED" name="Tomcat 8.5.37" level="application_server_libraries" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://E:/tomcat8/apache-tomcat-8.5.37/lib/tomcat-jdbc.jar!/" />
<root url="jar://C:/Program Files/Apache Software Foundation/Tomcat 8.5/lib/tomcat-jdbc.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

@ -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;
}

@ -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<String, Object> options;
private User subject;
@Override
public void execute(User subject) {
public void execute(User subject) throws GExcptSQL {
this.setSubject(subject);
DBManagement.update("update stu ");
}

@ -1,7 +1,15 @@
package core.operation;
import core.user.User;
import error.GExcptSQL;
import java.util.Map;
public class UploadFileOperation extends Operation {
Map<String, Object> options;
@Override
public void execute(User subject) throws GExcptSQL {
}
}

@ -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);
}
}

@ -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);
}
}

@ -4,6 +4,10 @@ import java.util.ArrayList;
import java.util.List;
public class Condition {
public List<Process> getProcesses() {
return processes;
}
private List<Process> processes;
public Process get(int index){
return processes.get(index);

@ -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);
}
}

@ -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;
}
}

@ -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<AtomProcess> processes;
private Map<String,List<Process>> lastProcesses;
private List<TemporaryProcess> temporaryProcesses;
private Map<String, List<Process>> lastProcesses;
private List<AuxiliaryProcess> 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<Integer> 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;
}

@ -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);
}
}

@ -11,6 +11,15 @@ public abstract class User implements AccountManageable, ProcessConfigurable{
private String id;
private String password;
private List<String> 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))

@ -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;
}

@ -0,0 +1,7 @@
package error;
public class GExcptFactory extends GExcpt {
public GExcptFactory(String info) {
super(info);
}
}

@ -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 {
}
}

@ -16,4 +16,12 @@
<servlet-name>default</servlet-name>
<url-pattern>*.jpg</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.css</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.js</url-pattern>
</servlet-mapping>
</web-app>

@ -23,6 +23,5 @@ $(document).ready(
function () {
$('.to-register').on('click', showRegister);
$('.to-login').on('click', showlogin);
$('.submit-style').on('click',)
})

Loading…
Cancel
Save