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 924caed..eb1a084 100644 --- a/src/main/java/com/example/cosmos_serversb/models/Groups.java +++ b/src/main/java/com/example/cosmos_serversb/models/Groups.java @@ -6,14 +6,12 @@ import com.example.cosmos_serversb.entities.*; import org.hibernate.Session; import org.hibernate.SessionFactory; -import org.hibernate.boot.MetadataSources; -import org.hibernate.boot.registry.StandardServiceRegistry; -import org.hibernate.boot.registry.StandardServiceRegistryBuilder; @Singleton public class Groups { private static Groups theInstance = null; private static ArrayList groups = new ArrayList<>(); + private static HashMap testMap = new HashMap<>(); private static SessionFactory sessionFactory; private static String baseURI = "http://nitta-lab-www.is.konan-u.ac.jp/"; @@ -42,14 +40,16 @@ return rId; } + //getGroupsListByUidは現状うまく処理されない public static HashMap getGroupsListByUid(String uId){ - return createTestHashMap(); + return getTestHashMap(); } public static Group createGroup(String name, String uId){ //先にGidとuriの発行を行う String gId = getInstance().createGId(); String uri = baseURI + AppName + "/groups/" + gId; + createTestHashMap(gId, uri); Group testGroup = new Group(gId, uri, name, uId); Session session = sessionFactory.openSession(); session.beginTransaction(); @@ -87,19 +87,19 @@ } public static HashMap getMembersListByGid(String gId){ - return createTestHashMap(); + return null; } public static HashMap addMember(String gId, String uId){ - return createTestHashMap(); + return null; } public static HashMap deleteMember(String gId, String uId){ - return createTestHashMap(); + return null; } public static HashMap getRequestsListByGid(String gId){ - return createTestHashMap(); + return null; } public static Request addRequests(String gId, String uId, String product, String deadline, int location){ @@ -129,18 +129,17 @@ } //テスト用に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"); + public static void createTestHashMap(String gId, String uri){ + testMap.put(gId, uri); /* //Key, valueの取り出し方例(拡張for文) for (String key : TestMap.keySet()) { System.out.println(key + " " + TestMap.get(key)); } */ + } + public static HashMap getTestHashMap(){ return testMap; }