Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/12/10 10:57:21 (14 years ago)
Author:
kgrading
Message:

changed the complete DAL to LINQ 2 SQL (with the exception of the job streaming), did a lot of refactoring, Introduced DTOs (that are named DTOs for better understanding), added the spring.NET Interceptor, reintroduced transactions and cleaned up the whole JobResult thing and updated a part of the config merger (#830)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/JobAdapter.cs

    r2117 r3011  
    3737  class JobAdapter :
    3838    DataAdapterBase<dsHiveServerTableAdapters.JobTableAdapter,
    39                       Job,
     39                      JobDto,
    4040                      dsHiveServer.JobRow>,
    4141    IJobAdapter {
     
    8787        if (clientAdapter == null)
    8888          clientAdapter =
    89             this.Session.GetDataAdapter<ClientInfo, IClientAdapter>();
     89            this.Session.GetDataAdapter<ClientDto, IClientAdapter>();
    9090
    9191        return clientAdapter;
     
    112112        if (pluginInfoAdapter == null) {
    113113          pluginInfoAdapter =
    114             this.Session.GetDataAdapter<HivePluginInfo, IPluginInfoAdapter>();
     114            this.Session.GetDataAdapter<HivePluginInfoDto, IPluginInfoAdapter>();
    115115        }
    116116
     
    125125        if (projectAdapter == null) {
    126126          projectAdapter =
    127             this.Session.GetDataAdapter<Project, IProjectAdapter>();
     127            this.Session.GetDataAdapter<ProjectDto, IProjectAdapter>();
    128128        }
    129129
     
    137137
    138138    #region Overrides
    139     protected override Job ConvertRow(dsHiveServer.JobRow row,
    140       Job job) {
     139    protected override JobDto ConvertRow(dsHiveServer.JobRow row,
     140      JobDto job) {
    141141      if (row != null && job != null) {
    142142        job.Id = row.JobId;
     
    203203        job.PluginsNeeded.Clear();
    204204        foreach (Guid requiredPlugin in requiredPlugins) {
    205           HivePluginInfo pluginInfo =
     205          HivePluginInfoDto pluginInfo =
    206206            PluginInfoAdapter.GetById(requiredPlugin);
    207207
     
    218218    }
    219219
    220     protected override dsHiveServer.JobRow ConvertObj(Job job,
     220    protected override dsHiveServer.JobRow ConvertObj(JobDto job,
    221221      dsHiveServer.JobRow row) {
    222222      if (job != null && row != null) {
     
    250250          row.SetJobStateNull();
    251251
     252        //Todo: commout
     253        /*
    252254        row.Percentage = job.Percentage;
    253255
     
    266268        row.CoresNeeded = job.CoresNeeded;
    267269
    268         row.MemoryNeeded = job.MemoryNeeded;
     270        row.MemoryNeeded = job.MemoryNeeded;*/
    269271
    270272        if (job.Project != null)
     
    279281
    280282    #region IJobAdapter Members
    281     public ICollection<Job> GetAllSubjobs(Job job) {
     283    public ICollection<JobDto> GetAllSubjobs(JobDto job) {
    282284      if (job != null) {
    283285        return
     
    291293    }
    292294
    293     public ICollection<Job> GetJobsByState(State state) {
     295    public ICollection<JobDto> GetJobsByState(State state) {
    294296      return
    295297         base.FindMultiple(
     
    299301    }
    300302
    301     public ICollection<Job> GetJobsOf(ClientInfo client) {
     303    public ICollection<JobDto> GetJobsOf(ClientDto client) {
    302304      if (client != null) {
    303305        return
     
    311313    }
    312314
    313     public ICollection<Job> GetActiveJobsOf(ClientInfo client) {
     315    public ICollection<JobDto> GetActiveJobsOf(ClientDto client) {
    314316
    315317      if (client != null) {
     
    324326    }
    325327
    326     public ICollection<Job> GetJobsOf(Guid userId) {     
     328    public ICollection<JobDto> GetJobsOf(Guid userId) {     
    327329      return
    328330          base.FindMultiple(
     
    332334    }
    333335
    334     public ICollection<Job> FindJobs(State state, int cores, int memory,
     336    public ICollection<JobDto> FindJobs(State state, int cores, int memory,
    335337      Guid resourceId) {
    336338      return
     
    345347    }
    346348
    347     public ICollection<Job> GetJobsByProject(Guid projectId) {
     349    public ICollection<JobDto> GetJobsByProject(Guid projectId) {
    348350      return
    349351         base.FindMultiple(
     
    353355    }
    354356
    355     protected override void doUpdate(Job obj) {
     357    protected override void doUpdate(JobDto obj) {
    356358      if (obj != null) {
    357359        ProjectAdapter.Update(obj.Project);
     
    364366        List<Guid> relationships =
    365367          new List<Guid>();
    366         foreach (HivePluginInfo pluginInfo in obj.PluginsNeeded) {
     368        foreach (HivePluginInfoDto pluginInfo in obj.PluginsNeeded) {
    367369          //first check if pluginInfo already exists in the db
    368           HivePluginInfo found = PluginInfoAdapter.GetByNameVersionBuilddate(
     370          HivePluginInfoDto found = PluginInfoAdapter.GetByNameVersionBuilddate(
    369371            pluginInfo.Name, pluginInfo.Version, pluginInfo.BuildDate);
    370372          if (found != null) {
     
    384386    }
    385387
    386     protected override bool doDelete(Job job) {
     388    protected override bool doDelete(JobDto job) {
    387389      if (job != null) {
    388390        dsHiveServer.JobRow row =
     
    403405
    404406          //delete orphaned pluginInfos
    405           ICollection<HivePluginInfo> orphanedPluginInfos =
     407          ICollection<HivePluginInfoDto> orphanedPluginInfos =
    406408             PluginInfoAdapter.GetOrphanedPluginInfos();
    407           foreach(HivePluginInfo orphanedPlugin in orphanedPluginInfos) {
     409          foreach(HivePluginInfoDto orphanedPlugin in orphanedPluginInfos) {
    408410            PluginInfoAdapter.Delete(orphanedPlugin);
    409411          }
Note: See TracChangeset for help on using the changeset viewer.