package _VisualDVM.Passes.All;
import Common.Database.Objects.DBObject;
import _VisualDVM.Current;
import _VisualDVM.Global;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.Passes.Server.CloneServerObject;
import _VisualDVM.Repository.Server.ServerCode;
import _VisualDVM.Repository.Server.ServerExchangeUnit_2021;
import _VisualDVM.TestingSystem.Common.TestingServer;
import _VisualDVM.TestingSystem.SAPFOR.SapforSettings.SapforSettings;
import _VisualDVM.TestingSystem.SAPFOR.SapforSettingsCommand.SapforSettingsCommand;

import java.util.Vector;
public class CloneSapforSettings extends CloneServerObject<TestingServer, SapforSettings> {
    public CloneSapforSettings() {
        super(Global.testingServer, SapforSettings.class);
    }
    @Override
    protected Current currentName() {
        return Current.SapforSettings;
    }
    @Override
    protected void ServerAction() throws Exception {
        super.ServerAction();
        Vector<PassCode> codes = src.getCodes();
        Vector<DBObject> new_commands = new Vector<>();
        for (PassCode code : codes) {
            SapforSettingsCommand command = new SapforSettingsCommand();
            command.sapforsettings_id = (int) pk;
            command.passCode = code;
            new_commands.add(command);
        }
        Command(new ServerExchangeUnit_2021(ServerCode.PublishObjects, null, new_commands));
    }
}