Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/23/18 15:42:13 (6 years ago)
Author:
jzenisek
Message:

#2839

  • worked on UpdateJob(..)
  • adapted permission and assignment handling methods
  • adpated dbml of HiveDataContext using the designer (added delete rules and onNull-handling)
Location:
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/JobDao.cs

    r15630 r15643  
    4545    }
    4646
     47    public IEnumerable<Job> GetJobsReadyForDeletion() {
     48      return GetJobsReadyForDeletionQuery(DataContext);
     49    }
     50
    4751
    4852    #region Compiled queries
     
    6266         where job.State == jobState
    6367         select job.JobId).ToList());
     68    private static readonly Func<DataContext, IEnumerable<Job>> GetJobsReadyForDeletionQuery =
     69      CompiledQuery.Compile((DataContext db) =>
     70        (from job in db.GetTable<Job>()
     71         where job.State == JobState.StatisticsPending
     72         && (from task in db.GetTable<Task>()
     73             where task.JobId == job.JobId
     74             select task.State == TaskState.Finished
     75              || task.State == TaskState.Aborted
     76              || task.State == TaskState.Failed).All(x => x)
     77         select job).ToList());
    6478    #endregion
    6579
     
    6983      WHERE JobState = {0}
    7084    ";
     85    private const string GetStatisticsPendingJobs = @"
     86      SELECT DISTINCT j.*
     87      FROM [Job] j
     88      WHERE j.JobState = 'StatisticsPending'
     89      AND 'Calculating' NOT IN (
     90        SELECT t.TaskState
     91        FROM [Task] t
     92        WHERE t.JobId = j.JobId)
     93    ";
    7194    #endregion
    7295  }
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.designer.cs

    r15630 r15643  
    390390    }
    391391   
    392     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedProjectResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE")]
     392    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedProjectResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE", DeleteOnNull=true)]
    393393    public Resource Resource
    394394    {
     
    424424    }
    425425   
    426     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedProjectResource", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true, DeleteRule="CASCADE")]
     426    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedProjectResource", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true, DeleteRule="CASCADE", DeleteOnNull=true)]
    427427    public Project Project
    428428    {
     
    10981098    }
    10991099   
    1100     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedProjectResource", Storage="_AssignedResources", ThisKey="ResourceId", OtherKey="ResourceId")]
     1100    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedProjectResource", Storage="_AssignedResources", ThisKey="ResourceId", OtherKey="ResourceId", DeleteRule="CASCADE")]
    11011101    public EntitySet<AssignedProjectResource> AssignedProjectResources
    11021102    {
     
    11631163    }
    11641164   
    1165     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedJobResource", Storage="_AssignedJobResources", ThisKey="ResourceId", OtherKey="ResourceId")]
     1165    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedJobResource", Storage="_AssignedJobResources", ThisKey="ResourceId", OtherKey="ResourceId", DeleteRule="CASCADE")]
    11661166    public EntitySet<AssignedJobResource> AssignedJobResources
    11671167    {
     
    26692669    }
    26702670   
    2671     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_Task", Storage="_Jobs", ThisKey="JobId", OtherKey="JobId")]
     2671    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_Task", Storage="_Jobs", ThisKey="JobId", OtherKey="JobId", DeleteRule="CASCADE")]
    26722672    public EntitySet<Task> Tasks
    26732673    {
     
    26822682    }
    26832683   
    2684     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_JobPermission", Storage="_HiveExperimentPermissions", ThisKey="JobId", OtherKey="JobId")]
     2684    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_JobPermission", Storage="_HiveExperimentPermissions", ThisKey="JobId", OtherKey="JobId", DeleteRule="CASCADE")]
    26852685    public EntitySet<JobPermission> JobPermissions
    26862686    {
     
    26952695    }
    26962696   
    2697     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_AssignedJobResource", Storage="_AssignedJobResources", ThisKey="JobId", OtherKey="JobId")]
     2697    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_AssignedJobResource", Storage="_AssignedJobResources", ThisKey="JobId", OtherKey="JobId", DeleteRule="CASCADE")]
    26982698    public EntitySet<AssignedJobResource> AssignedJobResources
    26992699    {
     
    35333533    }
    35343534   
    3535     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_JobPermission", Storage="_HiveExperiment", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true)]
     3535    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_JobPermission", Storage="_HiveExperiment", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true, DeleteRule="CASCADE", DeleteOnNull=true)]
    35363536    public Job Job
    35373537    {
     
    58335833    }
    58345834   
    5835     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedProjectResource", Storage="_AssignedResources", ThisKey="ProjectId", OtherKey="ProjectId")]
     5835    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedProjectResource", Storage="_AssignedResources", ThisKey="ProjectId", OtherKey="ProjectId", DeleteRule="CASCADE")]
    58365836    public EntitySet<AssignedProjectResource> AssignedProjectResources
    58375837    {
     
    58725872    }
    58735873   
    5874     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_ProjectPermission", Storage="_ProjectPermissions", ThisKey="ProjectId", OtherKey="ProjectId")]
     5874    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_ProjectPermission", Storage="_ProjectPermissions", ThisKey="ProjectId", OtherKey="ProjectId", DeleteRule="CASCADE")]
    58755875    public EntitySet<ProjectPermission> ProjectPermissions
    58765876    {
     
    60846084    }
    60856085   
    6086     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_ProjectPermission", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true)]
     6086    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_ProjectPermission", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true, DeleteRule="CASCADE", DeleteOnNull=true)]
    60876087    public Project Project
    60886088    {
     
    63866386    }
    63876387   
    6388     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedJobResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true)]
     6388    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedJobResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE", DeleteOnNull=true)]
    63896389    public Resource Resource
    63906390    {
     
    64206420    }
    64216421   
    6422     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_AssignedJobResource", Storage="_Job", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true)]
     6422    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_AssignedJobResource", Storage="_Job", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true, DeleteRule="CASCADE", DeleteOnNull=true)]
    64236423    public Job Job
    64246424    {
Note: See TracChangeset for help on using the changeset viewer.