package _VisualDVM.Passes.All;
import _VisualDVM.Global;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.Passes.Server.ComponentsRepositoryPass;
import _VisualDVM.Repository.Server.ServerCode;
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
import _VisualDVM.Repository.Subscribes.Subscriber;
public class AddSubscriber extends ComponentsRepositoryPass<Subscriber> {
    @Override
    public String getIconPath() {
        return "/icons/RedAdd.png";
    }
    @Override
    public String getButtonText() {
        return "";
    }
    @Override
    protected boolean canStart(Object... args) throws Exception {
        target = new Subscriber();
        return fillObjectFields();
    }
    protected boolean fillObjectFields() throws Exception {
        return server.db.subscribers.ShowAddObjectDialog(target);
    }
    @Override
    protected void ServerAction() throws Exception {
        Command(new ServerExchangeUnit_2021(ServerCode.PublishObject, "", target));
    }
    @Override
    protected void performFinish() throws Exception {
        super.performFinish();
        Global.mainModule.getPass(PassCode.SynchronizeBugReports).Do();
    }
    @Override
    protected void showDone() throws Exception {
        super.showDone();
        server.db.subscribers.ui_.Show(target.getPK());
    }
}
