diff --git a/APP/.idea/dataSources.local.xml b/APP/.idea/dataSources.local.xml index 7c2b0f7..6ceaea1 100644 --- a/APP/.idea/dataSources.local.xml +++ b/APP/.idea/dataSources.local.xml @@ -1,6 +1,6 @@ - + $#@ diff --git a/APP/.idea/workspace.xml b/APP/.idea/workspace.xml index a90cb71..a1d057e 100644 --- a/APP/.idea/workspace.xml +++ b/APP/.idea/workspace.xml @@ -5,11 +5,15 @@ - - - - - + + + + + + + + + diff --git a/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/Service/Filter.java b/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/Service/Filter.java index 222dfe7..40e7f09 100644 --- a/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/Service/Filter.java +++ b/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/Service/Filter.java @@ -2,5 +2,11 @@ //-------INTERFACE public interface Filter { + /** + * @param data Object + * @apiNote This method processes the data. + * @implNote This implementation consists of the data. + * @since 1.0 + */ void process(Object data); } diff --git a/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/Service/JsonFileReaderFilter.java b/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/Service/JsonFileReaderFilter.java index f391212..c60b3e3 100644 --- a/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/Service/JsonFileReaderFilter.java +++ b/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/Service/JsonFileReaderFilter.java @@ -14,6 +14,13 @@ public JsonFileReaderFilter(Filter nextFilter) { this.nextFilter = nextFilter; } + /** + * @param data Object + * @apiNote This method processes the data. + * @implNote This implementation consists of the data. + * @since 1.0 + * @see JsonFileReaderFilter + */ @Override public void process(Object data) { try { diff --git a/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/Service/MuseumExtractorFilter.java b/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/Service/MuseumExtractorFilter.java index c6ab1cb..892f570 100644 --- a/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/Service/MuseumExtractorFilter.java +++ b/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/Service/MuseumExtractorFilter.java @@ -8,6 +8,12 @@ import java.util.ArrayList; import java.util.List; +/** + * @version 1.0 + * @apiNote This class represents a museum extractor filter. + * @implNote This implementation consists of the next filter. + * @since 1.0 + */ //-----MUSEUM DATA EXTRACTOR FROM JSON FILE public class MuseumExtractorFilter implements Filter{ private final Filter nextFilter; @@ -20,7 +26,17 @@ public MuseumExtractorFilter(Filter nextFilter) { private static List museums = new ArrayList<>(); - + /** + * @param input String + * @return List + * @apiNote This method searches the museums in the list of museums. Filters them by name. Returns a list of museums. + * @implNote This implementation consists of the input. + * @since 1.0 + * + * @deprecated + * reason: This method is not used anymore. Data has already been filtered and stored in the database. + * + */ public static List searchmuseums(String input) { List museums = getMuseums(); List filteredMuseums = new ArrayList<>(); @@ -32,6 +48,14 @@ public static List searchmuseums(String input) { return filteredMuseums; } + /** + * @return List + * @apiNote This method returns a list of museums. + * @implNote This implementation consists of the museums. + * @since 1.0 + * @see Museum + * @deprecated + */ public static List getOpenNow() { List museums = getMuseums(); List filteredMuseums = new ArrayList<>(); @@ -76,6 +100,13 @@ public static List getSkopje() { return filteredMuseums; } + /** + * @param data Object + * @apiNote This method processes the data. Takes tags like name, latitude, longitude, street, email, internetAccess, wikidata, openingHours, phone, fee, charge and website. + * @implNote This implementation consists of the data. + * @since 1.0 + * @see MuseumExtractorFilter + */ @Override public void process(Object data) { JsonNode jsonData = (JsonNode) data; @@ -96,6 +127,18 @@ public void process(Object data) { } } + /** + * @param node JsonNode + * @return Museum + * @apiNote This method creates a museum. + * @implNote This implementation consists of the node. + * @since 1.0 + * + * @Note Only Use this when you want to add new fresh list of museums to the database from the export[number].json file. + * @see MuseumExtractorFilter + * @deprecated + * + */ private Museum createMuseum(JsonNode node) { JsonNode tags = node.get("tags"); diff --git a/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/model/Museum.java b/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/model/Museum.java index 4efdd39..cf82b2b 100644 --- a/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/model/Museum.java +++ b/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/model/Museum.java @@ -5,7 +5,14 @@ import java.util.List; -//MUSEUM CLASS + +/** + * @version 1.0 + * @apiNote This class represents a museum. + * @implNote This implementation consists of the name, latitude, longitude, street, email, internetAccess, wikidata, openingHours, phone, fee, charge and website. + * @since 1.0 + * + */ @Data @Entity @Table(name = "Museums") @@ -15,6 +22,13 @@ public Museum() { } + /** + * @return String + * @apiNote Returns a string representation of the object. + * @implNote This implementation returns a string representation consisting of the name, latitude, longitude, street, email, internetAccess, wikidata, openingHours, phone, fee, charge and website. + * @since 1.0 + * + */ @Override public String toString() { return "Museum{" + @@ -33,6 +47,7 @@ public String toString() { '}'; } + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; diff --git a/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/model/Review.java b/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/model/Review.java index 7b5f94a..36aafd5 100644 --- a/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/model/Review.java +++ b/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/model/Review.java @@ -5,6 +5,12 @@ import lombok.Getter; +/** + * @version 1.0 + * @apiNote This class represents a museum. + * @implNote This implementation consists of the name, latitude, longitude, street, email, internetAccess, wikidata, openingHours, phone, fee, charge and website. + * @since 1.0 + */ @Data @Entity @Table(name = "Reviews") diff --git a/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/model/User.java b/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/model/User.java index b372b9a..e3529bd 100644 --- a/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/model/User.java +++ b/APP/src/main/java/mk/finki/ukim/museumapp/PipeAndFilter/model/User.java @@ -3,6 +3,13 @@ import jakarta.persistence.*; import lombok.Data; +/** + * @version 1.0 + * @apiNote This class represents a user. + * @implNote This implementation consists of the username, password, email and role. + * @since 1.0 + * @see User + */ @Data @Entity @Table(name = "Users") diff --git a/APP/src/main/java/mk/finki/ukim/museumapp/controllers/MuseumsTable.java b/APP/src/main/java/mk/finki/ukim/museumapp/controllers/MuseumsTable.java index ee9dd7d..61add23 100644 --- a/APP/src/main/java/mk/finki/ukim/museumapp/controllers/MuseumsTable.java +++ b/APP/src/main/java/mk/finki/ukim/museumapp/controllers/MuseumsTable.java @@ -14,7 +14,12 @@ import java.util.List; - +/** + * @version 1.0 + * @apiNote This class represents a museum. + * @implNote This implementation consists of the name, latitude, longitude, street, email, internetAccess, wikidata, openingHours, phone, fee, charge and website. + * @since 1.0 + */ @Controller @RequestMapping("/") public class MuseumsTable { @@ -28,6 +33,14 @@ public MuseumsTable(MuseumService museumService, UserService userService, Review this.reviewService = reviewService; } + /** + * @param model model + * @param error error + * @return String + * @apiNote Returns museums view with model attribute museums, bodyContent and error. + * @implNote This implementation returns a string representation consisting of the museums, bodyContent and error. + * @since 1.0 + */ @GetMapping("/edit.html") public String getMuseums(Model model, @RequestParam(required = false) String error) { List museums = museumService.getMuseums(); @@ -38,6 +51,13 @@ public String getMuseums(Model model, @RequestParam(required = false) String err } + /** + * @param model model + * @return String + * @apiNote Returns main page with all museums. + * @implNote This implementation returns a string representation consisting of the museums. + * @since 1.0 + */ @GetMapping public String getIndex(Model model) { List museums = museumService.getMuseums(); @@ -46,6 +66,14 @@ public String getIndex(Model model) { return "index"; } + /** + * @param model model + * @param search search + * @return String + * @apiNote Returns search results. + * @implNote This implementation returns a string representation consisting of the museums. + * @since 1.0 + */ @GetMapping("/search") String getSearch(Model model, @RequestParam String search) { //if search is empty return all museums @@ -59,6 +87,13 @@ String getSearch(Model model, @RequestParam String search) { return "index"; } + /** + * @param model model + * @return String + * @apiNote Filters the museums that are open now. + * @implNote This implementation returns a string representation consisting of the museums. + * @since 1.0 + */ @GetMapping("/OpenNow") String getOpenNow(Model model) { List filteredMuseums = museumService.getOpenNow(); @@ -94,6 +129,16 @@ String getSkopje(Model model) { return "index"; } + /** + * @param model + * @param username + * @param password + * @return String + * @apiNote It is used to login the user, if user is admin it redirects to edit.html else it redirects to index.html. + * + * @implNote This implementation returns a string representation consisting of the user. + * @since 1.0 + */ @PostMapping("/LoginMethod") String getLoginMethod(Model model, @RequestParam String username, @RequestParam String password){ @@ -116,6 +161,13 @@ String getLoginMethod(Model model, @RequestParam String username, @RequestParam return "redirect:/Login.html?error=Error, Try again"; } + /** + * @param model model + * @return String + * @apiNote Returns to the Login view with model attribute user. + * @implNote This implementation returns a string representation consisting of the user. + * @since 1.0 + */ @GetMapping("/Login.html") String getLogin(Model model) { System.out.println("Login"); @@ -128,6 +180,16 @@ String getRegister(Model model) { return "Register"; } + /** + * @param model + * @param username + * @param password + * @param email + * @return String + * @apiNote It is used to register the user, if user exists it redirects to Register.html else it redirects to index.html. + * @implNote This implementation returns a string representation consisting of the user. + * @since 1.0 + */ @PostMapping("/RegisterMethod") String getRegisterMethod(Model model, @RequestParam String username, @RequestParam String password, @RequestParam String email){ @@ -142,12 +204,26 @@ String getRegisterMethod(Model model, @RequestParam String username, @RequestPar } + /** + * @param model + * @return String + * @apiNote Returns to the MuseumEdit view with model attribute museum. Used to create a new museum. + * @implNote This implementation returns a string representation consisting of the museum. + * @since 1.0 + */ @GetMapping("/museums/create") public String createMuseum(Model model) { System.out.println("EDIT MUSEUM"); return "MuseumEdit"; } + /** + * @param model + * @return String + * @apiNote Returns to the EditReviews view with model attribute reviews. Used to edit reviews. + * @implNote This implementation returns a string representation consisting of the reviews. + * @since 1.0 + */ @GetMapping("/museums/editreviews") public String editReviews(Model model) { List reviews = reviewService.GetAllReviews(); @@ -155,6 +231,27 @@ public String editReviews(Model model) { return "EditReviews"; } + /** + * @param model + * @param id + * @param name + * @param latitude + * @param longitude + * @param street + * @param email + * @param internetAccess + * @param wikidata + * @param openingHours + * @param phone + * @param fee + * @param charge + * @param website + * @return String + * @apiNote It is used to create a new museum, if museum exists it deletes the museum and creates a new one. + * @implNote This implementation returns a string representation consisting of the museum. + * @since 1.0 + * @see Museum + */ @PostMapping("/museum/add") public String createMuseum(Model model, @RequestParam int id, @RequestParam String name, @RequestParam String latitude, @RequestParam String longitude, @RequestParam String street, @RequestParam String email, @RequestParam String internetAccess, @RequestParam String wikidata, @RequestParam String openingHours, @RequestParam String phone, @RequestParam String fee, @RequestParam String charge, @RequestParam String website) { @@ -173,6 +270,14 @@ public String createMuseum(Model model, @RequestParam int id, @RequestParam Stri return "redirect:/edit.html"; } + /** + * @param model + * @param id + * @return String + * @apiNote It is used to delete a museum. + * @implNote This implementation returns a string representation consisting of the museum. + * @since 1.0 + */ @GetMapping("/museums/delete/{id}") public String deleteMuseum(Model model, @PathVariable int id) { museumService.deleteMuseum(id); @@ -180,6 +285,14 @@ public String deleteMuseum(Model model, @PathVariable int id) { return "redirect:/edit.html"; } + /** + * @param model + * @param id + * @return String + * @apiNote It is used to delete a review. + * @implNote This implementation returns a string representation consisting of the review. + * @since 1.0 + */ @GetMapping("/reviews/delete/{id}") public String deleteReview(Model model, @PathVariable int id) { reviewService.deleteReview(id); @@ -187,6 +300,14 @@ public String deleteReview(Model model, @PathVariable int id) { return "redirect:/museums/editreviews"; } + /** + * @param model + * @param id + * @return String + * @apiNote It is used to edit a museum. + * @implNote This implementation returns a string representation consisting of the museum. + * @since 1.0 + */ @GetMapping("/museums/edit/{id}") public String editMuseum(Model model, @PathVariable int id) { Museum museum = museumService.getMuseum(id); @@ -194,6 +315,14 @@ public String editMuseum(Model model, @PathVariable int id) { return "MuseumEdit"; } + /** + * @param model + * @param id + * @return String + * @apiNote It is used to add a review. + * @implNote This implementation returns a string representation consisting of the museum. + * @since 1.0 + */ @GetMapping("/addreview/{id}") public String addReview(Model model, @PathVariable int id) { Museum museum = museumService.getMuseum(id); @@ -201,6 +330,17 @@ public String addReview(Model model, @PathVariable int id) { return "AddReview"; } + /** + * @param model + * @param museum_id + * @param review + * @param username + * @param stars + * @return String + * @apiNote It is used to create a new review. Adds + * @implNote This implementation returns a string representation consisting of the review. + * @since 1.0 + */ @PostMapping("/museum/createReview") public String addReview(Model model, @RequestParam int museum_id, @RequestParam String review, @RequestParam String username, @RequestParam int stars) { Review review1 = reviewService.saveReview(review, username, stars, museum_id);