| |
---|
| | private static Groups theInstance = null; |
---|
| | private static ArrayList<Group> groups = new ArrayList<>(); |
---|
| | |
---|
| | private static SessionFactory sessionFactory; |
---|
| | private static String baseURI = "http://nitta-lab-www.is.konan-u.ac.jp/"; |
---|
| | private static String AppName = "cosmos"; |
---|
| | |
---|
| | public static void setUp() { |
---|
| | // A SessionFactory is set up once for an application! |
---|
| | final StandardServiceRegistry registry = new StandardServiceRegistryBuilder() |
---|
| |
---|
| | } |
---|
| | return theInstance; |
---|
| | } |
---|
| | |
---|
| | public static String createGId() { |
---|
| | //gIdを作成し既存していないかチェック後DBに保存し作成したgIdを返す |
---|
| | String gId = UUID.randomUUID().toString(); |
---|
| | return gId; |
---|
| | } |
---|
| | |
---|
| | public static String createRId() { |
---|
| | //rIdを作成し既存していないかチェック後DBに保存し作成したrIdを返す |
---|
| | String rId = UUID.randomUUID().toString(); |
---|
| | return rId; |
---|
| | } |
---|
| | |
---|
| | public static HashMap<String, String> getGroupsListByUid(String uId){ |
---|
| | return createTestHashMap(); |
---|
| | } |
---|
| | |
---|
| | public static Group createGroup(String name, String uId){ |
---|
| | //先にGidとuriの発行を行う |
---|
| | Group testGroup = new Group("123456789", "http://test.com", name, uId); |
---|
| | String gId = getInstance().createGId(); |
---|
| | String uri = baseURI + AppName + "/groups/" + gId; |
---|
| | Group testGroup = new Group(gId, uri, name, uId); |
---|
| | Session session = sessionFactory.openSession(); |
---|
| | session.beginTransaction(); |
---|
| | session.save(testGroup); |
---|
| | session.getTransaction().commit(); |
---|
| |
---|
| | } |
---|
| | |
---|
| | 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", |
---|
| | String rId = getInstance().createRId(); |
---|
| | String uri = baseURI + AppName + "/groups/" + gId + "/requests/" + rId; |
---|
| | Request testRequest = new Request(rId, uri, "1999/01/01/15:00:00", |
---|
| | uId, product, "1999/01/01/15:00:00", 999); |
---|
| | return testRequest; |
---|
| | } |
---|
| | |
---|
| |
---|
| | |
---|
| | 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(rId, "http://test.com", "1999/01/01/15:00:00", |
---|
| | uId, product, "1999/01/01/15:00:00", 999); |
---|
| | |
---|
| | return testRequest; |
---|
| | } |
---|
| |
---|
| | |