mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-09-06 16:35:26 +00:00
added command to add/remove channels from channel groups
added storing the commands with their modules in the db renamed command impl module
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
package dev.sheldan.abstracto.command;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ModuleRegistry {
|
||||
CommandHierarchy getDetailedModules();
|
||||
List<Module> getModules();
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package dev.sheldan.abstracto.command.models;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "command")
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public class ACommand {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@Getter
|
||||
@Setter
|
||||
@JoinColumn(name = "module_id")
|
||||
private AModule module;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package dev.sheldan.abstracto.command.models;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table(name = "module")
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public class AModule {
|
||||
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
@OneToMany(
|
||||
fetch = FetchType.LAZY,
|
||||
cascade = CascadeType.ALL,
|
||||
orphanRemoval = true)
|
||||
@Builder.Default
|
||||
@JoinColumn(name = "module_id")
|
||||
private List<ACommand> commands = new ArrayList<>();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package dev.sheldan.abstracto.command.service;
|
||||
|
||||
import dev.sheldan.abstracto.command.models.ACommand;
|
||||
|
||||
public interface CommandService {
|
||||
ACommand createCommand(String name, String moduleName);
|
||||
Boolean doesCommandExist(String name);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package dev.sheldan.abstracto.command.service;
|
||||
|
||||
|
||||
import dev.sheldan.abstracto.command.CommandHierarchy;
|
||||
import dev.sheldan.abstracto.command.Module;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ModuleRegistry {
|
||||
CommandHierarchy getDetailedModules();
|
||||
List<Module> getModules();
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package dev.sheldan.abstracto.command;
|
||||
package dev.sheldan.abstracto.command.service;
|
||||
|
||||
import dev.sheldan.abstracto.command.Command;
|
||||
import dev.sheldan.abstracto.command.execution.CommandContext;
|
||||
import dev.sheldan.abstracto.command.execution.CommandResult;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package dev.sheldan.abstracto.command.service.management;
|
||||
|
||||
import dev.sheldan.abstracto.command.models.ACommand;
|
||||
import dev.sheldan.abstracto.command.models.AModule;
|
||||
|
||||
public interface CommandManagementService {
|
||||
ACommand createCommand(String name, String moduleName);
|
||||
ACommand createCommand(String name, AModule moduleName);
|
||||
ACommand findCommandByName(String name);
|
||||
Boolean doesCommandExist(String name);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package dev.sheldan.abstracto.command.service.management;
|
||||
|
||||
import dev.sheldan.abstracto.command.models.AModule;
|
||||
|
||||
public interface ModuleManagementService {
|
||||
AModule createModule(String name);
|
||||
AModule getOrCreate(String name);
|
||||
AModule findModuleByName(String name);
|
||||
Boolean doesModuleExist(String name);
|
||||
}
|
||||
Reference in New Issue
Block a user