Ignore:
Timestamp:
12/11/08 16:50:12 (12 years ago)
Author:
svonolfe
Message:

Added Job Adapter (#372)

File:
1 edited

Legend:

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

    r965 r971  
    5757
    5858        return clientGroupAdapter;
     59      }
     60    }
     61
     62    private IJobAdapter jobAdapter = null;
     63
     64    private IJobAdapter JobAdapter {
     65      get {
     66        if (jobAdapter == null) {
     67          jobAdapter = ServiceLocator.GetJobAdapter();
     68        }
     69
     70        return jobAdapter;
    5971      }
    6072    }
     
    183195        return null;
    184196      }
     197    }
     198
     199    public ClientInfo GetClientByName(string name) {
     200      ClientInfo client = new ClientInfo();
     201
     202      Resource res =
     203        ResAdapter.GetResourceByName(name);
     204
     205      if (res != null) {
     206        dsHiveServer.ClientRow row =
     207          data.FindByResourceId(res.ResourceId);
     208
     209        if (row != null) {
     210          Convert(row, client);
     211
     212          return client;
     213        }
     214      }
     215
     216      return null;
    185217    }
    186218
     
    211243
    212244        if (row != null) {
     245          //Referential integrity with client groups
    213246          ICollection<ClientGroup> clientGroups =
    214247            ClientGroupAdapter.MemberOf(client);
    215 
    216248          foreach (ClientGroup group in clientGroups) {
    217249            group.Resources.Remove(client);
     
    219251          }
    220252
     253          //Referential integrity with jobs
     254          ICollection<Job> jobs =
     255            JobAdapter.GetJobsOf(client);
     256          foreach (Job job in jobs) {
     257            JobAdapter.DeleteJob(job);
     258          }
     259
    221260          data.RemoveClientRow(row);
    222261
Note: See TracChangeset for help on using the changeset viewer.