diff --git a/src/core/operation/Delete.java b/src/core/operation/Delete.java index c9a78c5..2827091 100644 --- a/src/core/operation/Delete.java +++ b/src/core/operation/Delete.java @@ -4,12 +4,17 @@ import core.user.User; import dao.DBManagement; import error.GExcptSQL; +import java.util.HashMap; +import java.util.Map; + public class Delete extends Operation { @Override - public void execute(User subject) throws GExcptSQL { - String id = (String)options.get("id"); - String sql = "DELETE FROM graduation_design WHERE id = \'"+ - id+"\'"; - DBManagement.update(sql); + public Map execute(User subject) throws GExcptSQL { + Map map = new HashMap<>(); + map.put("id",(String)this.getOptions().get("id")); + for(String table:DBManagement.graduationDesignTables){ + DBManagement.delete(table,map); + } + return options; } } diff --git a/src/core/operation/Delete.json b/src/core/operation/Delete.json index 183384f..585f898 100644 --- a/src/core/operation/Delete.json +++ b/src/core/operation/Delete.json @@ -1,3 +1,6 @@ { - "id": "java.lang.String" + "options":{ + "id": "String" + }, + "return":{} } \ No newline at end of file diff --git a/src/core/operation/DownloadFile.java b/src/core/operation/DownloadFile.java index 1154c74..f33f474 100644 --- a/src/core/operation/DownloadFile.java +++ b/src/core/operation/DownloadFile.java @@ -1,4 +1,12 @@ package core.operation; -public class DownloadFile { +import core.user.User; + +import java.util.Map; + +public class DownloadFile extends Operation{ + @Override + public Map execute(User subject) throws Exception { + return this.getOptions(); + } } diff --git a/src/core/operation/DownloadFile.json b/src/core/operation/DownloadFile.json new file mode 100644 index 0000000..ad27ff9 --- /dev/null +++ b/src/core/operation/DownloadFile.json @@ -0,0 +1,6 @@ +{ + "options":{ + + }, + "return":{} +} \ No newline at end of file diff --git a/src/core/operation/FillInformation.java b/src/core/operation/FillInformation.java index 4c954b2..cb41906 100644 --- a/src/core/operation/FillInformation.java +++ b/src/core/operation/FillInformation.java @@ -1,4 +1,18 @@ package core.operation; -public class FillInformation { +import core.user.User; +import dao.DBManagement; + +import java.util.Map; + +public class FillInformation extends Operation{ + @Override + public Map execute(User subject) throws Exception { + String table = (String) this.getOptions().get("table"); + Map vMap = (Map) this.getOptions().get("vMap"); + Map limits = (Map) this.getOptions().get("limits"); + DBManagement.update(table,vMap,limits); + return this.getOptions(); + } + } diff --git a/src/core/operation/FillInformation.json b/src/core/operation/FillInformation.json new file mode 100644 index 0000000..f183059 --- /dev/null +++ b/src/core/operation/FillInformation.json @@ -0,0 +1,8 @@ +{ + "options":{ + "table":"String", + "vMap":"Map", + "limits":"Map" + }, + "return":{} +} \ No newline at end of file diff --git a/src/core/operation/Operation.java b/src/core/operation/Operation.java index 7c7971f..729a987 100644 --- a/src/core/operation/Operation.java +++ b/src/core/operation/Operation.java @@ -2,7 +2,7 @@ package core.operation; import core.user.User; -import error.GExcptSQL; +import error.GExcptFormat; import gdms.Mode; import java.util.Map; @@ -14,19 +14,21 @@ public abstract class Operation { Operation(){ super(); } + + public abstract Map execute(User subject) throws Exception; + public void setSubject(User subject) { + this.subject = subject; + } public User getSubject() { return subject; } - public void setSubject(User subject) { - this.subject = subject; + public Map getOptions() { + return options; } - public void setOptions(String options) { + public void setOptions(String options) throws GExcptFormat { this.options = core.operation.utils.util.string2MapOptions(options); } - public void setProcessOperations(String processOptions){ - setOptions(processOptions); - } - public void addUserOperations(String key, Object value){ + public void addOptions(String key, Object value){ if ( Mode.strict == 1){ if(!this.options.containsKey(key)) { try { @@ -38,6 +40,7 @@ public abstract class Operation { } this.options.put(key,value); } - public abstract void execute(User subject) throws Exception; - + public void setOptions(Map options) { + this.options = options; + } } diff --git a/src/core/operation/Search.java b/src/core/operation/Search.java index 5176b57..5638d4a 100644 --- a/src/core/operation/Search.java +++ b/src/core/operation/Search.java @@ -4,19 +4,31 @@ import core.user.User; import dao.DBManagement; import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; public class Search extends Operation { @Override - public void execute(User subject) throws Exception { - String table = (String)options.get("table"); - String field = (String)options.get("field"); - String value = (String)options.get("value"); - int start = (int)options.get("start"); - int end = (int)options.get("end"); - String sql = "SELECT * FROM "+table+ - " WHERE "+field+" = \'"+value+"\'"+ - " limit "+start+", "+end; - ResultSet rs = DBManagement.query(sql); - //todo + public Map execute(User subject) throws Exception { + String table = (String)this.getOptions().get("table"); + List fields = (List)this.getOptions().get("fields"); + Map limits = (Map)this.getOptions().get("limits"); + int start = (int)this.getOptions().get("start"); + int end = (int)this.getOptions().get("end"); + ResultSet rs = DBManagement.select(fields,table,limits,start,end); + ResultSetMetaData rsm = rs.getMetaData() ; + int columnCount = rsm.getColumnCount(); + List ls = new ArrayList<>(); + while(rs.next()){ + String[] s = new String[columnCount]; + for(int i=0;i" + } } \ No newline at end of file diff --git a/src/core/operation/Select.java b/src/core/operation/Select.java index f58ea03..9d09797 100644 --- a/src/core/operation/Select.java +++ b/src/core/operation/Select.java @@ -4,19 +4,25 @@ import core.user.User; import dao.DBManagement; import error.GExcptSQL; +import java.util.HashMap; import java.util.Map; public class Select extends Operation { @Override - public void execute(User subject) throws GExcptSQL { - String student_id = (String)options.get("student_id"); - String teacher_id = (String)options.get("teacher_id"); - String id = student_id; - String sql = "INSERT INTO graduation_design VALUES (\'"+ - id+"\', "+ - student_id+"\', "+ - teacher_id+"\', \'m\', \'m\')"; - DBManagement.update(sql); + public Map execute(User subject) throws GExcptSQL { + Map vMap = new HashMap<>(); + String id = (String)this.getOptions().get("student_id"); + String teacher_id = (String)this.getOptions().get("teacher_id"); + vMap.put("id",id); + vMap.put("student_id",id); + vMap.put("teacher_id",teacher_id); + DBManagement.insert("graduation_design", vMap); + vMap.remove("student_id"); + vMap.remove("teacher_id"); + for(int i=1;i options; - @Override - public void execute(User subject) throws GExcptSQL { - + public Map execute(User subject) throws GExcptSQL { + return this.getOptions(); } } diff --git a/src/core/operation/UploadFileOperation.json b/src/core/operation/UploadFileOperation.json index dae12c8..ed59a86 100644 --- a/src/core/operation/UploadFileOperation.json +++ b/src/core/operation/UploadFileOperation.json @@ -1,4 +1,6 @@ { - "java.lang.String": "activity", - "lava.io.File": "file" + "options":{ + "file": "File" + }, + "return":{} } \ No newline at end of file diff --git a/src/core/operation/utils/util.java b/src/core/operation/utils/util.java index 031ce17..edae565 100644 --- a/src/core/operation/utils/util.java +++ b/src/core/operation/utils/util.java @@ -1,5 +1,8 @@ package core.operation.utils; +import error.GExcptFormat; +import gdms.Mode; + import java.util.HashMap; import java.util.Map; @@ -7,12 +10,16 @@ public interface util { static String stringOptionsFormat(String options){ return options.replaceAll(" {2,}", " ") ; } - static Map string2MapOptions(String sOptions){ + static Map string2MapOptions(String sOptions) throws GExcptFormat { sOptions = stringOptionsFormat(sOptions); Map options = new HashMap<>(); String[] sOpts = sOptions.split(" "); for(int i=0;i temporaryProcesses; - private Map> lastProcesses; - private List auxiliaryProcesses; - public void setProcessesByJson(File file){ - //todo - } - public Process getTemporaryProcess(int index){ - return temporaryProcesses.get(index).clone(); - } public Condition getCondition(String userType, List index){ - Condition condition = new Condition(this.lastProcesses.get(userType)); - for(int i:index){ - condition.add(getTemporaryProcess(i)); - } - return condition; + return null; } } diff --git a/src/core/process/TemporaryProcess.java b/src/core/process/TemporaryProcess.java deleted file mode 100644 index 3f22949..0000000 --- a/src/core/process/TemporaryProcess.java +++ /dev/null @@ -1,9 +0,0 @@ -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/user/Administrator.java b/src/core/user/Administrator.java index 49af1c0..f56ff0d 100644 --- a/src/core/user/Administrator.java +++ b/src/core/user/Administrator.java @@ -1,4 +1,10 @@ package core.user; +import java.util.Map; + public class Administrator extends User { + @Override + public void setAttr(Map vMap){ + super.setAttr(vMap); + } } diff --git a/src/core/user/Student.java b/src/core/user/Student.java index 8600327..7365272 100644 --- a/src/core/user/Student.java +++ b/src/core/user/Student.java @@ -1,7 +1,31 @@ package core.user; import java.io.File; +import java.util.Map; public class Student extends User { + private String grade; + private String profession_code; + public void setAttr(Map vMap){ + super.setAttr(vMap); + this.setGrade(vMap.get("grade")); + this.setProfession_code(vMap.get("profession_code")); + } + + public String getGrade() { + return grade; + } + + public void setGrade(String grade) { + this.grade = grade; + } + + public String getProfession_code() { + return profession_code; + } + + public void setProfession_code(String profession_code) { + this.profession_code = profession_code; + } } diff --git a/src/core/user/Teacher.java b/src/core/user/Teacher.java index 80b297d..2a24d05 100644 --- a/src/core/user/Teacher.java +++ b/src/core/user/Teacher.java @@ -1,7 +1,41 @@ package core.user; import java.io.File; +import java.util.Map; public class Teacher extends User { + String job_title; + String education; + String profession_code; + @Override + public void setAttr(Map vMap){ + super.setAttr(vMap); + this.setEducation(vMap.get("education")); + this.setJob_title(vMap.get("job_title")); + this.setProfession_code(vMap.get("profession_code")); + } + public String getJob_title() { + return job_title; + } + + public void setJob_title(String job_title) { + this.job_title = job_title; + } + + public String getEducation() { + return education; + } + + public void setEducation(String education) { + this.education = education; + } + + public String getProfession_code() { + return profession_code; + } + + public void setProfession_code(String profession_code) { + this.profession_code = profession_code; + } } diff --git a/src/core/user/User.java b/src/core/user/User.java index 5c34eb0..89b29b0 100644 --- a/src/core/user/User.java +++ b/src/core/user/User.java @@ -5,6 +5,7 @@ import core.user.userFun.AccountManageable; import core.user.userFun.ProcessConfigurable; import java.util.List; +import java.util.Map; public abstract class User implements AccountManageable, ProcessConfigurable{ @@ -109,4 +110,11 @@ public abstract class User implements AccountManageable, ProcessConfigurable{ public void syncFromDatabase() { } + + public void setAttr(Map vMap){ + this.setId(vMap.get("id")); + this.setName(vMap.get("name")); + this.setE_mail_location(vMap.get("e_mail_location")); + this.setPhone_number(vMap.get("phone_number")); + } } diff --git a/src/core/user/utils/AccountManagement.java b/src/core/user/utils/AccountManagement.java index 7246b15..3467e77 100644 --- a/src/core/user/utils/AccountManagement.java +++ b/src/core/user/utils/AccountManagement.java @@ -8,26 +8,28 @@ import utils.Utils; import java.lang.reflect.InvocationTargetException; import java.sql.ResultSet; +import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; + +import static dao.DBManagement.userTables; public interface AccountManagement { - static String[] userTables = { - "administrator", - "student", - "teacher" - }; static User login(String id, String password) throws GExcptSQL, GExcptAccount, SQLException { ResultSet rs = null; - String sql = null; String userType = null; for(String userTable:userTables){ - sql = "SELECT * FROM "+userTable+" WHERE id=\'"+id+"\'"; + List columns = new ArrayList<>(); + columns.add("*"); + Map limits = new HashMap<>(); + limits.put("id",id); try { - rs = DBManagement.query(sql); + rs = DBManagement.select(columns,userTable,limits,1,2); } catch (Exception e) { - throw new GExcptSQL("QUERY\n\t"+sql+"\nfailure"); + throw new GExcptSQL("QUERY\n\t"+id+"\nfailure"); } if(rs!=null){ userType = userTable; @@ -41,25 +43,21 @@ public interface AccountManagement { try { if(!rs.getString(2).equals(password)) throw new GExcptAccount("password wrong"); - List necessaryInfo = new ArrayList<>(); - for(int i=0;i<4;i++){ - necessaryInfo.add(rs.getString(i)); + Map vMap = new HashMap<>(); + ResultSetMetaData rsm = rs.getMetaData(); + rs.next(); + for(int i=0;i necessaryInfo) throws GExcptSQL { - necessaryInfo = Utils.formatUserInfo(userType,necessaryInfo); - String sql = "INSERT INTO "+userType+" VALUES(\'"; - for(String info:necessaryInfo){ - sql+=info+"\', \'"; - } - sql =sql.substring(0,sql.length()-3)+")"; - DBManagement.update(sql); - return createUser(userType, necessaryInfo); + static User register(String userType, Map vMap) throws GExcptSQL { + DBManagement.insert(userType,vMap); + return createUser(userType, vMap); } static void logout(User user){ //todo @@ -70,25 +68,14 @@ public interface AccountManagement { static User getUser(String userType){ try { return (User) Class.forName("core.user."+ Utils.toUpperFirstChar(userType)).getDeclaredConstructor().newInstance(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { - e.printStackTrace(); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - } catch (ClassNotFoundException e) { + } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException | ClassNotFoundException e) { e.printStackTrace(); } return null; } - static User createUser(String userType, List necessaryInfo) { + static User createUser(String userType, Map vMap) { User user = getUser(userType); - user.setId(necessaryInfo.get(0)); - user.setName(necessaryInfo.get(1)); - user.setE_mail_location(necessaryInfo.get(2)); - user.setPhone_number(necessaryInfo.get(3)); + user.setAttr(vMap); return user; } } diff --git a/src/dao/DBManagement.java b/src/dao/DBManagement.java index c31829e..dd423cc 100644 --- a/src/dao/DBManagement.java +++ b/src/dao/DBManagement.java @@ -1,6 +1,8 @@ package dao; import java.sql.*; +import java.util.List; +import java.util.Map; import error.GExcptSQL; import org.apache.tomcat.jdbc.pool.DataSource; @@ -9,6 +11,24 @@ import org.apache.tomcat.jdbc.pool.PoolProperties; public class DBManagement { + public static String[] userTables = { + "administrator", + "student", + "teacher" + }; + public static String[] graduationDesignTables = { + "graduation_design", + "graduation_design_finished_product", + "graduation_design_finished_product_mentor_score", + "graduation_design_finished_product_reviewer_score", + "graduation_design_information", + "graduation_design_opening_report", + "graduation_design_opening_report_opinion_record", + "graduation_design_reply", + "graduation_design_reply_opinion_record_score" + }; + + static final String driverClassName="org.mariadb.jdbc.Driver"; static final String url="jdbc:mariadb://localhost:3306/gdms"; static final String username="gdms"; @@ -42,6 +62,26 @@ public class DBManagement { return null; } + public static void delete(String table, Map limits) throws GExcptSQL { + Delete delete = new Delete(table, limits); + String sql = delete.getSQL(); + update(sql); + } + public static void insert(String table, Map vMap) throws GExcptSQL { + Insert insert = new Insert(table, vMap); + String sql = insert.getSQL(); + update(sql); + } + public static ResultSet select(List columns, String table, Map limits, int startRow, int endRow) throws Exception { + Select select = new Select(columns,table,limits,startRow,endRow); + String sql = select.getSQL(); + return query(sql); + } + public static void update(String table, Map vMap, Map limits) throws GExcptSQL { + Update update = new Update(table,vMap,limits); + String sql = update.getSQL(); + update(sql); + } public static ResultSet query(String sql) throws Exception { if(!ifInit) return null; ResultSet rs = null; diff --git a/src/dao/Delete.java b/src/dao/Delete.java new file mode 100644 index 0000000..c52666a --- /dev/null +++ b/src/dao/Delete.java @@ -0,0 +1,31 @@ +package dao; + +import java.util.Map; + +public class Delete extends SQLStmt { + private static final String fs = "DELETE "; + private Map limits; + + Delete(String table, Map limits) { + super(table); + this.setLimits(limits); + } + @Override + public String getSQL() { + return this.getFs()+this.getLs(); + } + private String getLs(){ + return dao.Utils.whereAnd(this.getLimits()); + } + public String getFs(){ + return fs+this.getTable()+" "; + } + + private Map getLimits() { + return limits; + } + + private void setLimits(Map limits) { + this.limits = limits; + } +} diff --git a/src/dao/Insert.java b/src/dao/Insert.java new file mode 100644 index 0000000..4135bd6 --- /dev/null +++ b/src/dao/Insert.java @@ -0,0 +1,43 @@ +package dao; + +import utils.Utils; + +import java.util.Map; + +public class Insert extends SQLStmt { + private static final String fs ="INSERT INTO "; + private Map vMap; + Insert(String table, Map vMap){ + super(table); + this.setVMap(vMap); + } + @Override + public String getSQL() { + return this.getFs()+this.getVs(); + } + + @Override + public String getFs() { + return fs+this.getTable()+" "; + } + private String getVs(){ + StringBuilder sql = new StringBuilder("("); + for(String key: this.getVMap().keySet()){ + sql.append(key).append(", "); + } + sql = new StringBuilder(Utils.cutTail(sql.toString(), 2) + ") "); + sql.append("VALUES (\'"); + for(String value: vMap.values()){ + sql.append(value).append("\', \'"); + } + sql = new StringBuilder(Utils.cutTail(sql.toString(), 3) + ")"); + return sql.toString(); + } + private Map getVMap() { + return vMap; + } + + private void setVMap(Map vMap) { + this.vMap = vMap; + } +} diff --git a/src/dao/SQLStmt.java b/src/dao/SQLStmt.java new file mode 100644 index 0000000..61f653f --- /dev/null +++ b/src/dao/SQLStmt.java @@ -0,0 +1,16 @@ +package dao; + +public abstract class SQLStmt { + private String table; + SQLStmt(String table) { + this.setTable(table); + } + public abstract String getSQL(); + public abstract String getFs(); + String getTable() { + return table; + } + public void setTable(String table) { + this.table = table; + } +} diff --git a/src/dao/Select.java b/src/dao/Select.java new file mode 100644 index 0000000..472cd12 --- /dev/null +++ b/src/dao/Select.java @@ -0,0 +1,62 @@ +package dao; + +import java.util.List; +import java.util.Map; + +public class Select extends SQLStmt { + private static final String fs ="SELECT "; + private Map limits; + private List columns; + private int startRow; + private int endRow; + public Select(List columns, String table, Map limits, int startRow, int endRow){ + super(table); + this.setColumns(columns); + this.setLimits(limits); + this.setStartRow(startRow); + this.setEndRow(endRow); + } + @Override + public String getSQL() { + return this.getFs()+this.getTs()+this.getLs(); + } + private String getLs(){ + String sql = dao.Utils.whereAnd(this.getLimits())+" "; + sql+="LIMIT "+this.getStartRow()+", "+this.getEndRow(); + return sql; + } + @Override + public String getFs() { + return fs+dao.Utils.linkColumn(this.getColumns())+" "; + } + private String getTs(){ + return "FROM "+this.getTable()+" "; + } + private Map getLimits() { + return limits; + } + public void setLimits(Map limits) { + this.limits = limits; + } + private List getColumns() { + return columns; + } + public void setColumns(List columns) { + this.columns = columns; + } + private int getStartRow() { + return startRow; + } + + private void setStartRow(int startRow) { + this.startRow = startRow; + } + + private int getEndRow() { + return endRow; + } + + private void setEndRow(int endRow) { + this.endRow = endRow; + } +} diff --git a/src/dao/Update.java b/src/dao/Update.java new file mode 100644 index 0000000..20f9f88 --- /dev/null +++ b/src/dao/Update.java @@ -0,0 +1,52 @@ +package dao; + +import java.util.Map; + +public class Update extends SQLStmt { + private static final String fs ="UPDATE "; + private Map limits; + private Map vMap; + + + Update(String table, Map vMap, Map limits) { + super(table); + this.setVMap(vMap); + this.setLimits(limits); + } + + @Override + public String getSQL() { + return this.getFs()+this.getVs()+this.getLs(); + } + + @Override + public String getFs() { + return fs+this.getTable()+" "; + } + private String getLs(){ + return dao.Utils.whereAnd(this.getLimits()); + } + private String getVs(){ + String sql = "SET "; + sql+=Utils.linkColumn(Utils.linkKeyValue(this.getVMap()))+" "; + return sql; + } + + + private Map getLimits() { + return limits; + } + + public void setLimits(Map limits) { + this.limits = limits; + } + public Map getVMap() { + return vMap; + } + + public void setVMap(Map vMap) { + this.vMap = vMap; + } + + +} diff --git a/src/dao/Utils.java b/src/dao/Utils.java index 8f22aa1..309bc7c 100644 --- a/src/dao/Utils.java +++ b/src/dao/Utils.java @@ -1,6 +1,33 @@ package dao; -public interface Utils { - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +public interface Utils { + static String whereAnd(Map map){ + List list = linkKeyValue(map); + String sql = "WHERE "; + for(String s:list){ + sql+=s+" AND "; + } + sql = utils.Utils.cutTail(sql,5)+""; + return sql; + } + //with ", " + static String linkColumn(List list){ + String sql = ""; + for(String c:list){ + sql+=c+", "; + } + return utils.Utils.cutTail(sql,2); + } + //with " = " + static List linkKeyValue(Map map){ + List list = new ArrayList<>(); + for(Map.Entry entry:map.entrySet()){ + list.add(entry.getKey()+" = \'"+entry.getValue()+"\'"); + } + return list; + } } diff --git a/src/error/GExcptFormat.java b/src/error/GExcptFormat.java new file mode 100644 index 0000000..a0b3c6e --- /dev/null +++ b/src/error/GExcptFormat.java @@ -0,0 +1,7 @@ +package error; + +public class GExcptFormat extends GExcpt { + public GExcptFormat(String info) { + super(info); + } +} diff --git a/src/gdms/test.java b/src/gdms/test.java new file mode 100644 index 0000000..aac73b8 --- /dev/null +++ b/src/gdms/test.java @@ -0,0 +1,21 @@ +package gdms; + +import dao.Select; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class test { + public static void main(String[] args){ + List list = new ArrayList<>(); + list.add("q"); + list.add("w"); + Map map=new HashMap<>(); + map.put("a","b"); + map.put("c","d"); + Select sql = new Select(list,"zx",map,1,2); + System.out.println(sql.getSQL()); + } +} diff --git a/src/utils/Utils.java b/src/utils/Utils.java index a1c7c56..d439588 100644 --- a/src/utils/Utils.java +++ b/src/utils/Utils.java @@ -5,24 +5,26 @@ import java.util.List; import java.util.Map; public interface Utils { - public static Map userAttrNum =new HashMap<>() - + Map userAttrNum =new HashMap<>() { { - userAttrNum.put("administrator",5); - userAttrNum.put("student",7); - userAttrNum.put("teacher",8); + put("administrator",5); + put("student",7); + put("teacher",8); } }; - public static String toUpperFirstChar(String string) { + static String toUpperFirstChar(String string) { char[] charArray = string.toCharArray(); charArray[0] -= 32; return String.valueOf(charArray); } - public static List formatUserInfo(String userType, List userInfo){ + static List formatUserInfo(String userType, List userInfo){ for(int i=0;i