From 0d8fc65f85353579b69f5c840e9b9a4f20d148ec Mon Sep 17 00:00:00 2001 From: Vishal M Yadav Date: Sun, 1 Dec 2024 15:34:42 +0530 Subject: [PATCH] solved two problems -> trello and contact mgmt system --- .../{todo => done}/contactmgmt/Main.java | 10 +++++----- .../{todo => done}/contactmgmt/README.md | 0 .../contactmgmt/entities/Contact.java | 2 +- .../contactmgmt/entities/SearchResult.java | 2 +- .../contactmgmt/services/ContactRepository.java | 7 +++---- .../contactmgmt/services/ContactTrie.java | 2 +- .../contactmgmt/services/MapBasedStrategy.java | 6 +++--- .../contactmgmt/services/Node.java | 5 ++--- .../contactmgmt/services/SearchStrategy.java | 14 ++++++++++++++ .../gatomalvado/{todo => done}/trello/Main.java | 9 +++------ .../trello/entities/BaseEntity.java | 2 +- .../{todo => done}/trello/entities/Card.java | 4 ++-- .../{todo => done}/trello/entities/SubGroup.java | 4 ++-- .../{todo => done}/trello/entities/TaskUser.java | 4 ++-- .../trello/entities/TrelloBoard.java | 6 +++--- .../{todo => done}/trello/enums/EntityType.java | 2 +- .../{todo => done}/trello/enums/Status.java | 2 +- .../trello/service/BoardService.java | 14 +++++++------- .../contactmgmt/services/SearchStrategy.java | 16 ---------------- 19 files changed, 52 insertions(+), 59 deletions(-) rename src/main/java/com/gatomalvado/{todo => done}/contactmgmt/Main.java (87%) rename src/main/java/com/gatomalvado/{todo => done}/contactmgmt/README.md (100%) rename src/main/java/com/gatomalvado/{todo => done}/contactmgmt/entities/Contact.java (91%) rename src/main/java/com/gatomalvado/{todo => done}/contactmgmt/entities/SearchResult.java (79%) rename src/main/java/com/gatomalvado/{todo => done}/contactmgmt/services/ContactRepository.java (92%) rename src/main/java/com/gatomalvado/{todo => done}/contactmgmt/services/ContactTrie.java (52%) rename src/main/java/com/gatomalvado/{todo => done}/contactmgmt/services/MapBasedStrategy.java (92%) rename src/main/java/com/gatomalvado/{todo => done}/contactmgmt/services/Node.java (73%) create mode 100644 src/main/java/com/gatomalvado/done/contactmgmt/services/SearchStrategy.java rename src/main/java/com/gatomalvado/{todo => done}/trello/Main.java (95%) rename src/main/java/com/gatomalvado/{todo => done}/trello/entities/BaseEntity.java (77%) rename src/main/java/com/gatomalvado/{todo => done}/trello/entities/Card.java (91%) rename src/main/java/com/gatomalvado/{todo => done}/trello/entities/SubGroup.java (90%) rename src/main/java/com/gatomalvado/{todo => done}/trello/entities/TaskUser.java (90%) rename src/main/java/com/gatomalvado/{todo => done}/trello/entities/TrelloBoard.java (88%) rename src/main/java/com/gatomalvado/{todo => done}/trello/enums/EntityType.java (83%) rename src/main/java/com/gatomalvado/{todo => done}/trello/enums/Status.java (53%) rename src/main/java/com/gatomalvado/{todo => done}/trello/service/BoardService.java (93%) delete mode 100644 src/main/java/com/gatomalvado/todo/contactmgmt/services/SearchStrategy.java diff --git a/src/main/java/com/gatomalvado/todo/contactmgmt/Main.java b/src/main/java/com/gatomalvado/done/contactmgmt/Main.java similarity index 87% rename from src/main/java/com/gatomalvado/todo/contactmgmt/Main.java rename to src/main/java/com/gatomalvado/done/contactmgmt/Main.java index 84da536..1f251d7 100644 --- a/src/main/java/com/gatomalvado/todo/contactmgmt/Main.java +++ b/src/main/java/com/gatomalvado/done/contactmgmt/Main.java @@ -1,11 +1,11 @@ -package com.gatomalvado.todo.contactmgmt; +package com.gatomalvado.done.contactmgmt; import java.util.UUID; -import com.gatomalvado.todo.contactmgmt.entities.Contact; -import com.gatomalvado.todo.contactmgmt.services.ContactRepository; -import com.gatomalvado.todo.contactmgmt.services.MapBasedStrategy; -import com.gatomalvado.todo.contactmgmt.services.SearchStrategy; +import com.gatomalvado.done.contactmgmt.entities.Contact; +import com.gatomalvado.done.contactmgmt.services.ContactRepository; +import com.gatomalvado.done.contactmgmt.services.MapBasedStrategy; +import com.gatomalvado.done.contactmgmt.services.SearchStrategy; public class Main { diff --git a/src/main/java/com/gatomalvado/todo/contactmgmt/README.md b/src/main/java/com/gatomalvado/done/contactmgmt/README.md similarity index 100% rename from src/main/java/com/gatomalvado/todo/contactmgmt/README.md rename to src/main/java/com/gatomalvado/done/contactmgmt/README.md diff --git a/src/main/java/com/gatomalvado/todo/contactmgmt/entities/Contact.java b/src/main/java/com/gatomalvado/done/contactmgmt/entities/Contact.java similarity index 91% rename from src/main/java/com/gatomalvado/todo/contactmgmt/entities/Contact.java rename to src/main/java/com/gatomalvado/done/contactmgmt/entities/Contact.java index 744bacf..8d44fa8 100644 --- a/src/main/java/com/gatomalvado/todo/contactmgmt/entities/Contact.java +++ b/src/main/java/com/gatomalvado/done/contactmgmt/entities/Contact.java @@ -1,4 +1,4 @@ -package com.gatomalvado.todo.contactmgmt.entities; +package com.gatomalvado.done.contactmgmt.entities; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/src/main/java/com/gatomalvado/todo/contactmgmt/entities/SearchResult.java b/src/main/java/com/gatomalvado/done/contactmgmt/entities/SearchResult.java similarity index 79% rename from src/main/java/com/gatomalvado/todo/contactmgmt/entities/SearchResult.java rename to src/main/java/com/gatomalvado/done/contactmgmt/entities/SearchResult.java index 67b3a87..e5c1802 100644 --- a/src/main/java/com/gatomalvado/todo/contactmgmt/entities/SearchResult.java +++ b/src/main/java/com/gatomalvado/done/contactmgmt/entities/SearchResult.java @@ -1,4 +1,4 @@ -package com.gatomalvado.todo.contactmgmt.entities; +package com.gatomalvado.done.contactmgmt.entities; import java.util.List; diff --git a/src/main/java/com/gatomalvado/todo/contactmgmt/services/ContactRepository.java b/src/main/java/com/gatomalvado/done/contactmgmt/services/ContactRepository.java similarity index 92% rename from src/main/java/com/gatomalvado/todo/contactmgmt/services/ContactRepository.java rename to src/main/java/com/gatomalvado/done/contactmgmt/services/ContactRepository.java index bcd0442..50501ba 100644 --- a/src/main/java/com/gatomalvado/todo/contactmgmt/services/ContactRepository.java +++ b/src/main/java/com/gatomalvado/done/contactmgmt/services/ContactRepository.java @@ -1,13 +1,12 @@ -package com.gatomalvado.todo.contactmgmt.services; +package com.gatomalvado.done.contactmgmt.services; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; -import com.gatomalvado.todo.contactmgmt.entities.Contact; -import com.gatomalvado.todo.contactmgmt.entities.SearchResult; +import com.gatomalvado.done.contactmgmt.entities.Contact; +import com.gatomalvado.done.contactmgmt.entities.SearchResult; public class ContactRepository { diff --git a/src/main/java/com/gatomalvado/todo/contactmgmt/services/ContactTrie.java b/src/main/java/com/gatomalvado/done/contactmgmt/services/ContactTrie.java similarity index 52% rename from src/main/java/com/gatomalvado/todo/contactmgmt/services/ContactTrie.java rename to src/main/java/com/gatomalvado/done/contactmgmt/services/ContactTrie.java index 932e0cd..1d83568 100644 --- a/src/main/java/com/gatomalvado/todo/contactmgmt/services/ContactTrie.java +++ b/src/main/java/com/gatomalvado/done/contactmgmt/services/ContactTrie.java @@ -1,4 +1,4 @@ -package com.gatomalvado.todo.contactmgmt.services; +package com.gatomalvado.done.contactmgmt.services; public class ContactTrie { diff --git a/src/main/java/com/gatomalvado/todo/contactmgmt/services/MapBasedStrategy.java b/src/main/java/com/gatomalvado/done/contactmgmt/services/MapBasedStrategy.java similarity index 92% rename from src/main/java/com/gatomalvado/todo/contactmgmt/services/MapBasedStrategy.java rename to src/main/java/com/gatomalvado/done/contactmgmt/services/MapBasedStrategy.java index f9ceab6..9627705 100644 --- a/src/main/java/com/gatomalvado/todo/contactmgmt/services/MapBasedStrategy.java +++ b/src/main/java/com/gatomalvado/done/contactmgmt/services/MapBasedStrategy.java @@ -1,4 +1,4 @@ -package com.gatomalvado.todo.contactmgmt.services; +package com.gatomalvado.done.contactmgmt.services; import java.util.ArrayList; import java.util.HashMap; @@ -6,8 +6,8 @@ import java.util.Map; import java.util.stream.Collectors; -import com.gatomalvado.todo.contactmgmt.entities.Contact; -import com.gatomalvado.todo.contactmgmt.entities.SearchResult; +import com.gatomalvado.done.contactmgmt.entities.Contact; +import com.gatomalvado.done.contactmgmt.entities.SearchResult; public class MapBasedStrategy implements SearchStrategy { diff --git a/src/main/java/com/gatomalvado/todo/contactmgmt/services/Node.java b/src/main/java/com/gatomalvado/done/contactmgmt/services/Node.java similarity index 73% rename from src/main/java/com/gatomalvado/todo/contactmgmt/services/Node.java rename to src/main/java/com/gatomalvado/done/contactmgmt/services/Node.java index de6365c..4303dec 100644 --- a/src/main/java/com/gatomalvado/todo/contactmgmt/services/Node.java +++ b/src/main/java/com/gatomalvado/done/contactmgmt/services/Node.java @@ -1,15 +1,14 @@ -package com.gatomalvado.todo.contactmgmt.services; +package com.gatomalvado.done.contactmgmt.services; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import com.gatomalvado.todo.contactmgmt.entities.Contact; +import com.gatomalvado.done.contactmgmt.entities.Contact; import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; @Data @AllArgsConstructor diff --git a/src/main/java/com/gatomalvado/done/contactmgmt/services/SearchStrategy.java b/src/main/java/com/gatomalvado/done/contactmgmt/services/SearchStrategy.java new file mode 100644 index 0000000..2c29acd --- /dev/null +++ b/src/main/java/com/gatomalvado/done/contactmgmt/services/SearchStrategy.java @@ -0,0 +1,14 @@ +package com.gatomalvado.done.contactmgmt.services; + +import com.gatomalvado.done.contactmgmt.entities.Contact; +import com.gatomalvado.done.contactmgmt.entities.SearchResult; + +public interface SearchStrategy { + + void access(Contact contact); + + void remove(Contact contact); + + SearchResult search(String fieldValue, String fieldName); + +} diff --git a/src/main/java/com/gatomalvado/todo/trello/Main.java b/src/main/java/com/gatomalvado/done/trello/Main.java similarity index 95% rename from src/main/java/com/gatomalvado/todo/trello/Main.java rename to src/main/java/com/gatomalvado/done/trello/Main.java index 7594719..ef9e7b6 100644 --- a/src/main/java/com/gatomalvado/todo/trello/Main.java +++ b/src/main/java/com/gatomalvado/done/trello/Main.java @@ -1,13 +1,10 @@ -package com.gatomalvado.todo.trello; +package com.gatomalvado.done.trello; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import com.gatomalvado.todo.trello.entities.TaskUser; -import com.gatomalvado.todo.trello.entities.TrelloBoard; -import com.gatomalvado.todo.trello.enums.Status; -import com.gatomalvado.todo.trello.service.BoardService; +import com.gatomalvado.done.trello.entities.TaskUser; +import com.gatomalvado.done.trello.service.BoardService; public class Main { diff --git a/src/main/java/com/gatomalvado/todo/trello/entities/BaseEntity.java b/src/main/java/com/gatomalvado/done/trello/entities/BaseEntity.java similarity index 77% rename from src/main/java/com/gatomalvado/todo/trello/entities/BaseEntity.java rename to src/main/java/com/gatomalvado/done/trello/entities/BaseEntity.java index b676fd2..3c48e4a 100644 --- a/src/main/java/com/gatomalvado/todo/trello/entities/BaseEntity.java +++ b/src/main/java/com/gatomalvado/done/trello/entities/BaseEntity.java @@ -1,4 +1,4 @@ -package com.gatomalvado.todo.trello.entities; +package com.gatomalvado.done.trello.entities; public abstract class BaseEntity { public abstract String getEntityType(); diff --git a/src/main/java/com/gatomalvado/todo/trello/entities/Card.java b/src/main/java/com/gatomalvado/done/trello/entities/Card.java similarity index 91% rename from src/main/java/com/gatomalvado/todo/trello/entities/Card.java rename to src/main/java/com/gatomalvado/done/trello/entities/Card.java index c6f3d56..98b5eed 100644 --- a/src/main/java/com/gatomalvado/todo/trello/entities/Card.java +++ b/src/main/java/com/gatomalvado/done/trello/entities/Card.java @@ -1,8 +1,8 @@ -package com.gatomalvado.todo.trello.entities; +package com.gatomalvado.done.trello.entities; import java.util.Objects; -import com.gatomalvado.todo.trello.enums.EntityType; +import com.gatomalvado.done.trello.enums.EntityType; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/src/main/java/com/gatomalvado/todo/trello/entities/SubGroup.java b/src/main/java/com/gatomalvado/done/trello/entities/SubGroup.java similarity index 90% rename from src/main/java/com/gatomalvado/todo/trello/entities/SubGroup.java rename to src/main/java/com/gatomalvado/done/trello/entities/SubGroup.java index d2d61e8..144de16 100644 --- a/src/main/java/com/gatomalvado/todo/trello/entities/SubGroup.java +++ b/src/main/java/com/gatomalvado/done/trello/entities/SubGroup.java @@ -1,9 +1,9 @@ -package com.gatomalvado.todo.trello.entities; +package com.gatomalvado.done.trello.entities; import java.util.Objects; import java.util.Set; -import com.gatomalvado.todo.trello.enums.EntityType; +import com.gatomalvado.done.trello.enums.EntityType; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/src/main/java/com/gatomalvado/todo/trello/entities/TaskUser.java b/src/main/java/com/gatomalvado/done/trello/entities/TaskUser.java similarity index 90% rename from src/main/java/com/gatomalvado/todo/trello/entities/TaskUser.java rename to src/main/java/com/gatomalvado/done/trello/entities/TaskUser.java index e591e72..de470c6 100644 --- a/src/main/java/com/gatomalvado/todo/trello/entities/TaskUser.java +++ b/src/main/java/com/gatomalvado/done/trello/entities/TaskUser.java @@ -1,9 +1,9 @@ -package com.gatomalvado.todo.trello.entities; +package com.gatomalvado.done.trello.entities; import java.util.Objects; import java.util.Set; -import com.gatomalvado.todo.trello.enums.EntityType; +import com.gatomalvado.done.trello.enums.EntityType; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/src/main/java/com/gatomalvado/todo/trello/entities/TrelloBoard.java b/src/main/java/com/gatomalvado/done/trello/entities/TrelloBoard.java similarity index 88% rename from src/main/java/com/gatomalvado/todo/trello/entities/TrelloBoard.java rename to src/main/java/com/gatomalvado/done/trello/entities/TrelloBoard.java index ad752d3..01f3ea3 100644 --- a/src/main/java/com/gatomalvado/todo/trello/entities/TrelloBoard.java +++ b/src/main/java/com/gatomalvado/done/trello/entities/TrelloBoard.java @@ -1,10 +1,10 @@ -package com.gatomalvado.todo.trello.entities; +package com.gatomalvado.done.trello.entities; import java.util.Objects; import java.util.Set; -import com.gatomalvado.todo.trello.enums.EntityType; -import com.gatomalvado.todo.trello.enums.Status; +import com.gatomalvado.done.trello.enums.EntityType; +import com.gatomalvado.done.trello.enums.Status; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/src/main/java/com/gatomalvado/todo/trello/enums/EntityType.java b/src/main/java/com/gatomalvado/done/trello/enums/EntityType.java similarity index 83% rename from src/main/java/com/gatomalvado/todo/trello/enums/EntityType.java rename to src/main/java/com/gatomalvado/done/trello/enums/EntityType.java index 3db4f24..4de3aca 100644 --- a/src/main/java/com/gatomalvado/todo/trello/enums/EntityType.java +++ b/src/main/java/com/gatomalvado/done/trello/enums/EntityType.java @@ -1,4 +1,4 @@ -package com.gatomalvado.todo.trello.enums; +package com.gatomalvado.done.trello.enums; public enum EntityType { BOARD("board"), diff --git a/src/main/java/com/gatomalvado/todo/trello/enums/Status.java b/src/main/java/com/gatomalvado/done/trello/enums/Status.java similarity index 53% rename from src/main/java/com/gatomalvado/todo/trello/enums/Status.java rename to src/main/java/com/gatomalvado/done/trello/enums/Status.java index d9c366d..33e6845 100644 --- a/src/main/java/com/gatomalvado/todo/trello/enums/Status.java +++ b/src/main/java/com/gatomalvado/done/trello/enums/Status.java @@ -1,4 +1,4 @@ -package com.gatomalvado.todo.trello.enums; +package com.gatomalvado.done.trello.enums; public enum Status { PUBLIC, diff --git a/src/main/java/com/gatomalvado/todo/trello/service/BoardService.java b/src/main/java/com/gatomalvado/done/trello/service/BoardService.java similarity index 93% rename from src/main/java/com/gatomalvado/todo/trello/service/BoardService.java rename to src/main/java/com/gatomalvado/done/trello/service/BoardService.java index 15fc80b..66dd26e 100644 --- a/src/main/java/com/gatomalvado/todo/trello/service/BoardService.java +++ b/src/main/java/com/gatomalvado/done/trello/service/BoardService.java @@ -1,16 +1,16 @@ -package com.gatomalvado.todo.trello.service; +package com.gatomalvado.done.trello.service; import java.util.HashMap; import java.util.Map; import java.util.Set; import java.util.UUID; -import com.gatomalvado.todo.trello.entities.BaseEntity; -import com.gatomalvado.todo.trello.entities.TrelloBoard; -import com.gatomalvado.todo.trello.entities.Card; -import com.gatomalvado.todo.trello.entities.SubGroup; -import com.gatomalvado.todo.trello.entities.TaskUser; -import com.gatomalvado.todo.trello.enums.Status; +import com.gatomalvado.done.trello.entities.BaseEntity; +import com.gatomalvado.done.trello.entities.TrelloBoard; +import com.gatomalvado.done.trello.entities.Card; +import com.gatomalvado.done.trello.entities.SubGroup; +import com.gatomalvado.done.trello.entities.TaskUser; +import com.gatomalvado.done.trello.enums.Status; public class BoardService { diff --git a/src/main/java/com/gatomalvado/todo/contactmgmt/services/SearchStrategy.java b/src/main/java/com/gatomalvado/todo/contactmgmt/services/SearchStrategy.java deleted file mode 100644 index efe83ee..0000000 --- a/src/main/java/com/gatomalvado/todo/contactmgmt/services/SearchStrategy.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.gatomalvado.todo.contactmgmt.services; - -import java.util.List; - -import com.gatomalvado.todo.contactmgmt.entities.Contact; -import com.gatomalvado.todo.contactmgmt.entities.SearchResult; - -public interface SearchStrategy { - - void access(Contact contact); - - void remove(Contact contact); - - SearchResult search(String fieldValue, String fieldName); - -}