diff --git a/src/main/java/org/ntlab/nemophila/models/shops/ShopManager.java b/src/main/java/org/ntlab/nemophila/models/shops/ShopManager.java index eae8908..be41ff6 100644 --- a/src/main/java/org/ntlab/nemophila/models/shops/ShopManager.java +++ b/src/main/java/org/ntlab/nemophila/models/shops/ShopManager.java @@ -1,7 +1,11 @@ package org.ntlab.nemophila.models.shops; -import java.util.HashMap; +import org.ntlab.nemophila.models.accounts.Post; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; +import java.util.UUID; public class ShopManager { private static ShopManager theInstance = null; @@ -24,12 +28,37 @@ return shopsMap.get(id); } + public Collection getShops() { + return shopsMap.values(); + } + + //idからその店の投稿を取得 + public ArrayList getPosts (String id) { + Shop shop = shopsMap.get(id); + return shop.getPosts(); + } + //お店のidとその店を紐づけて保存 - public void setShopsMap(Shop shop) { + public void createShop(String name, double longitude, double latitude) { + UUID uuid = UUID.randomUUID(); + String id = uuid.toString(); + + //インスタンス生成 + Shop shop = new Shop(); + shop.setId(id); + shop.setName(name); + shop.setLongitude(longitude); + shop.setLatitude(latitude); + + //生成したインスタンスを登録 + updateShop(shop); + } + + public void updateShop(Shop shop) { shopsMap.put(shop.getId(), shop); } - public void deleteShop(String id) { + public void removeShop(String id) { shopsMap.remove(id); } -} +} \ No newline at end of file