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:
Sheldan
2020-04-04 17:09:28 +02:00
parent bf94af66d5
commit 20b282584a
64 changed files with 637 additions and 71 deletions

View File

@@ -1,9 +0,0 @@
package dev.sheldan.abstracto.command;
import java.util.List;
public interface ModuleRegistry {
CommandHierarchy getDetailedModules();
List<Module> getModules();
}

View File

@@ -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;
}

View File

@@ -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<>();
}

View File

@@ -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);
}

View File

@@ -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();
}

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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);
}