diff --git a/src/main/java/com/example/cosmos_serversb/models/Groups.java b/src/main/java/com/example/cosmos_serversb/models/Groups.java index cdf8d01..9986a26 100644 --- a/src/main/java/com/example/cosmos_serversb/models/Groups.java +++ b/src/main/java/com/example/cosmos_serversb/models/Groups.java @@ -2,8 +2,10 @@ import java.util.*; import javax.inject.Singleton; +import javax.persistence.Column; import com.example.cosmos_serversb.entities.*; + @Singleton public class Groups { private static Groups thaInstance = null; @@ -20,14 +22,13 @@ return thaInstance; } - public static HashMap getGroupsListByUid(String uId){ - return null; + return createTestHashMap(); } public static Group createGroup(String name, String uId){ //先にGidとuriの発行を行う - Group testGroup = new Group("123456789", "http://test,com", name, uId); + Group testGroup = new Group("123456789", "http://test.com", name, uId); groups.add(testGroup); return testGroup; } @@ -53,25 +54,24 @@ } public static HashMap getMembersListByGid(String gId){ - return null; + return createTestHashMap(); } public static HashMap addMember(String gId, String uId){ - return null; + return createTestHashMap(); } public static HashMap deleteMember(String gId, String uId){ - return null; + return createTestHashMap(); } public static HashMap getRequestsListByGid(String gId){ - return null; + return createTestHashMap(); } - public static Request addRequests(String gId, String uId, String product, - String deadline, int location){ + public static Request addRequests(String gId, String uId, String product, String deadline, int location){ //テスト用 - Request testRequest = new Request("123456789", "http://test,com", "1999/01/01/15:00:00", + Request testRequest = new Request("123456789", "http://test.com", "1999/01/01/15:00:00", uId, product, "1999/01/01/15:00:00", 999); return testRequest; } @@ -80,11 +80,10 @@ return null; } - public static Request updateRequest(String gId, String rId, String uId, String product, - String deadline, int location, boolean done){ + public static Request updateRequest(String gId, String rId, String uId, String product, String deadline, int location, boolean done){ //テスト用 - Request testRequest = new Request("123456789", "http://test,com", "1999/01/01/15:00:00", + Request testRequest = new Request("123456789", "http://test.com", "1999/01/01/15:00:00", uId, product, "1999/01/01/15:00:00", 999); return testRequest; @@ -93,4 +92,20 @@ public static DeleteResult deleteRequest(String gId, String rId){ return DeleteResult.SUCCESS; } + + //テスト用にHashMapの作成 + public static HashMap createTestHashMap(){ + HashMap testMap = new HashMap<>(); + testMap.put("123456780", "http://test0.com"); + testMap.put("123456781", "http://test1.com"); + testMap.put("123456782", "http://test2.com"); + /* + //Key, valueの取り出し方例(拡張for文) + for (String key : TestMap.keySet()) { + System.out.println(key + " " + TestMap.get(key)); + } + */ + return testMap; + } + }