introduced ModuleRegistry to easy inter-module dependencies
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
/* © SRSoftware 2025 */
|
||||
package de.srsoftware.umbrella.core;
|
||||
|
||||
import de.srsoftware.umbrella.core.api.*;
|
||||
|
||||
public class ModuleRegistry {
|
||||
private Translator translator;
|
||||
private PostBox postBox;
|
||||
private UserService userService;
|
||||
private TagService tagService;
|
||||
private BookmarkService bookmarkService;
|
||||
private CompanyService companyService;
|
||||
private DocumentService documentService;
|
||||
private ItemService itemService;
|
||||
private MarkdownService markdownService;
|
||||
private NoteService noteService;
|
||||
private ProjectService projectService;
|
||||
private TaskService taskService;
|
||||
private TimeService timeService;
|
||||
|
||||
public ModuleRegistry add(BookmarkService bookmarkService) {
|
||||
this.bookmarkService = bookmarkService;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModuleRegistry add(CompanyService companyService) {
|
||||
this.companyService = companyService;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModuleRegistry add(DocumentService documentService) {
|
||||
this.documentService = documentService;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModuleRegistry add(ItemService itemService) {
|
||||
this.itemService = itemService;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModuleRegistry add(MarkdownService markdownService) {
|
||||
this.markdownService = markdownService;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModuleRegistry add(NoteService noteService) {
|
||||
this.noteService = noteService;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModuleRegistry add(PostBox postBox) {
|
||||
this.postBox = postBox;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModuleRegistry add(ProjectService projectService) {
|
||||
this.projectService = projectService;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModuleRegistry add(TagService tagService) {
|
||||
this.tagService = tagService;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModuleRegistry add(TaskService taskService) {
|
||||
this.taskService = taskService;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModuleRegistry add(TimeService timeService) {
|
||||
this.timeService = timeService;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModuleRegistry add(Translator translator) {
|
||||
this.translator = translator;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ModuleRegistry add(UserService userService) {
|
||||
this.userService = userService;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CompanyService companyService(){
|
||||
return companyService;
|
||||
}
|
||||
|
||||
public DocumentService documentService(){
|
||||
return documentService;
|
||||
}
|
||||
|
||||
public NoteService noteService(){
|
||||
return noteService;
|
||||
}
|
||||
|
||||
public PostBox postBox() {
|
||||
return postBox;
|
||||
}
|
||||
|
||||
public ProjectService projectService(){
|
||||
return projectService;
|
||||
}
|
||||
|
||||
public TagService tagService(){
|
||||
return tagService;
|
||||
}
|
||||
|
||||
public TaskService taskService(){
|
||||
return taskService;
|
||||
}
|
||||
|
||||
public Translator translator(){
|
||||
return translator;
|
||||
}
|
||||
|
||||
public UserService userService(){
|
||||
return userService;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,4 @@ public interface CompanyService {
|
||||
Map<Long,Company> listCompaniesOf(UmbrellaUser user) throws UmbrellaException;
|
||||
|
||||
boolean membership(long companyId, long userId) throws UmbrellaException;
|
||||
|
||||
UserService userService();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
/* © SRSoftware 2025 */
|
||||
package de.srsoftware.umbrella.core.api;
|
||||
|
||||
public interface DocumentService {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
/* © SRSoftware 2025 */
|
||||
package de.srsoftware.umbrella.core.api;
|
||||
|
||||
public interface ItemService {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
/* © SRSoftware 2025 */
|
||||
package de.srsoftware.umbrella.core.api;
|
||||
|
||||
public interface MarkdownService {
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ProjectService {
|
||||
CompanyService companyService();
|
||||
Map<Long,Project> listCompanyProjects(long companyId, boolean includeClosed) throws UmbrellaException;
|
||||
Map<Long,Project> listUserProjects(long userId, boolean includeClosed) throws UmbrellaException;
|
||||
Project load(long projectId);
|
||||
|
||||
@@ -13,6 +13,4 @@ public interface TagService {
|
||||
void save(String module, long entityId, Collection<Long> userIds, Collection<String> tags);
|
||||
|
||||
String save(String module, long entityId, Collection<Long> userIds, String tag);
|
||||
|
||||
UserService userService();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public interface TaskService {
|
||||
CompanyService companyService();
|
||||
HashMap<Long, Task> listCompanyTasks(long companyId) throws UmbrellaException;
|
||||
HashMap<Long, Task> listProjectTasks(long projectId) throws UmbrellaException;
|
||||
Collection<Task> loadMembers(Collection<Task> tasks);
|
||||
@@ -16,7 +15,4 @@ public interface TaskService {
|
||||
loadMembers(List.of(task));
|
||||
return task;
|
||||
}
|
||||
ProjectService projectService();
|
||||
|
||||
UserService userService();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package de.srsoftware.umbrella.core.api;
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
||||
import de.srsoftware.umbrella.core.model.Session;
|
||||
import de.srsoftware.umbrella.core.model.Token;
|
||||
import de.srsoftware.umbrella.core.model.UmbrellaUser;
|
||||
import java.util.Collection;
|
||||
@@ -10,10 +11,13 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface UserService {
|
||||
Map<Long, UmbrellaUser> list(Collection<Long> ids) throws UmbrellaException;
|
||||
void dropSession(Token token) throws UmbrellaException;
|
||||
Session extend(Session session) throws UmbrellaException;
|
||||
Map<Long, UmbrellaUser> list(Integer start, Integer limit, Collection<Long> ids) throws UmbrellaException;
|
||||
Session load(Token token) throws UmbrellaException;
|
||||
UmbrellaUser load(Session session) throws UmbrellaException;
|
||||
UmbrellaUser loadUser(long userId) throws UmbrellaException;
|
||||
Optional<UmbrellaUser> loadUser(Optional<Token> sessionToken) throws UmbrellaException;
|
||||
Optional<UmbrellaUser> loadUser(HttpExchange ex) throws UmbrellaException;
|
||||
PostBox postBox();
|
||||
Optional<UmbrellaUser> refreshSession(HttpExchange ex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user