Made the backend version of Undo/Redo
package com.nighthawk.spring_portfolio.mvc.classPeriod;
public class ActionData {
private String type; // Type of action (e.g., ADD_STUDENT, ADD_INSTRUCTOR)
private String id; // ID of the action (e.g., student ID, instructor ID)
private String name; // Name associated with the action (e.g., student name, instructor name)
private String email; // Email associated with the action (e.g., student email, instructor email)
// Constructors, getters, and setters
public ActionData() {
// Default constructor
}
public ActionData(String type, String id, String name, String email) {
this.type = type;
this.id = id;
this.name = name;
this.email = email;
}
// Getters and setters for each field
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
// toString method for debugging or logging
@Override
public String toString() {
return "ActionData{" +
"type='" + type + '\'' +
", id='" + id + '\'' +
", name='" + name + '\'' +
", email='" + email + '\'' +
'}';
}
Made the backend version of Undo/Redo package com.nighthawk.spring_portfolio.mvc.classPeriod;
public class ActionData { private String type; // Type of action (e.g., ADD_STUDENT, ADD_INSTRUCTOR) private String id; // ID of the action (e.g., student ID, instructor ID) private String name; // Name associated with the action (e.g., student name, instructor name) private String email; // Email associated with the action (e.g., student email, instructor email)
} 55 changes: 55 additions & 0 deletions55
src/main/java/com/nighthawk/spring_portfolio/mvc/classPeriod/UndoRedo.java Original file line number Original file line Diff line number Diff line change @@ -0,0 +1,55 @@ package com.nighthawk.spring_portfolio.mvc.classPeriod;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import java.util.Stack; import java.util.LinkedList; import java.util.Queue;
@RestController public class UndoRedo { private Stack undoStack;
private Stack redoStack;
private Queue actionsQueue;
}