package {{packageName}}.runtime;

import net.ibizsys.central.dataentity.IDataEntityRuntime;
import net.ibizsys.central.dataentity.service.IDEService;
import net.ibizsys.model.IPSDynaInstService;
import net.ibizsys.model.IPSSystemService;
import net.ibizsys.model.PSModelServiceImpl;
import net.ibizsys.model.res.IPSSysUtil;
import net.ibizsys.central.sysutil.SysUtilRuntimeBase;
import net.ibizsys.runtime.res.ISysUtilRuntime;
import net.ibizsys.central.plugin.boot.core.runtime.BootSystemRuntime;

public class SystemRuntimeBase extends BootSystemRuntime implements ISystemRuntime{

    @Override
    public String getName() {
        return "{{system.deploySysId}}";
    }

    @Override
    protected IPSSystemService createPSSystemService() throws Exception {
        PSModelServiceImpl psModelServiceImpl = new PSModelServiceImpl();
        psModelServiceImpl.setPSModelFolderPath("/model/{{replace packageName "." "/"}}", true);
        return psModelServiceImpl;
    }


{{#if system.allPSSysUtils}}
    @Override
    protected ISysUtilRuntime createDefaultSysUtilRuntime(IPSSysUtil iPSSysUtil) {
{{#each system.allPSSysUtils as |sysUtil|}}
        {{#if (and (eq sysUtil.utilType "USER")) (unless sysUtil.pSSysSFPlugin)}}
        if(iPSSysUtil.getCodeName().equals("{{sysUtil.codeName}}"))
            return new {{packageName}}.runtime.sysutil.{{sysUtil.codeName}}();
        {{/if}}
{{/each}}
        return super.createDefaultSysUtilRuntime(iPSSysUtil);
    }

{{/if}}
}
