Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/08/12 20:44:53 (13 years ago)
Author:
ascheibe
Message:

#1174 values of returned runs can now be limited

Location:
branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/HeuristicLab.Services.OKB-3.3.csproj

    r7574 r7589  
    147147    <Compile Include="Query\DataTransfer\BoolValue.cs" />
    148148    <Compile Include="Query\DataTransfer\CombinedFilter.cs" />
     149    <Compile Include="Query\DataTransfer\ValueName.cs" />
    149150    <Compile Include="Query\DataTransfer\NameOrdinalComparisonTimeSpanFilter.cs" />
    150151    <Compile Include="Query\DataTransfer\OrdinalComparisonTimeSpanFilter.cs" />
  • branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Query/Convert.cs

    r7574 r7589  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using System.Linq;
    2425using DA = HeuristicLab.Services.OKB.DataAccess;
     
    3233      dto.ParameterValues = source.Values.Where(x => x.ValueName.Category == DA.ValueNameCategory.Parameter).Select(x => Convert.ToDto(x, includeBinaryValues)).ToArray();
    3334      dto.ResultValues = source.Values.Where(x => x.ValueName.Category == DA.ValueNameCategory.Result).Select(x => Convert.ToDto(x, includeBinaryValues)).ToArray();
     35      return dto;
     36    }
     37
     38    public static DT.Run ToDto(DA.Run source, bool includeBinaryValues, IEnumerable<DT.ValueName> valueNames) {
     39      if (source == null) return null;
     40      var dto = new DT.Run { Id = source.Id, Algorithm = Convert.ToDto(source.Algorithm), Problem = Convert.ToDto(source.Problem), CreatedDate = source.CreatedDate, ClientId = source.ClientId, UserId = source.UserId };
     41      dto.ParameterValues = source.Values.Where(x => x.ValueName.Category == DA.ValueNameCategory.Parameter && valueNames.Count(y => y.Name == x.ValueName.Name) > 0).Select(x => Convert.ToDto(x, includeBinaryValues)).ToArray();
     42      dto.ResultValues = source.Values.Where(x => x.ValueName.Category == DA.ValueNameCategory.Result && valueNames.Count(y => y.Name == x.ValueName.Name) > 0).Select(x => Convert.ToDto(x, includeBinaryValues)).ToArray();
    3443      return dto;
    3544    }
     
    7483      }
    7584    }
     85
     86    public static DT.ValueName ToDto(DA.ValueName source) {
     87      if (source == null) return null;
     88      return new DT.ValueName() { Id = source.Id, Category = source.Category, Name = source.Name };
     89    }
    7690  }
    7791}
  • branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Query/IQueryService.cs

    r7331 r7589  
    4242    [OperationContract]
    4343    IEnumerable<Run> GetRuns(IEnumerable<long> ids, bool includeBinaryValues);
     44
     45    [OperationContract]
     46    IEnumerable<Run> GetRunsWithValues(IEnumerable<long> ids, bool includeBinaryValues, IEnumerable<DataTransfer.ValueName> valueNames);
     47
     48    [OperationContract]
     49    IEnumerable<ValueName> GetValueNames();
    4450  }
    4551}
  • branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Query/QueryService.cs

    r7574 r7589  
    258258    }
    259259
     260    public IEnumerable<DataTransfer.Run> GetRunsWithValues(IEnumerable<long> ids, bool includeBinaryValues, IEnumerable<DataTransfer.ValueName> valueNames) {
     261      using (OKBDataContext okb = new OKBDataContext()) {
     262        DataLoadOptions dlo = new DataLoadOptions();
     263        // TODO: specify LoadWiths
     264        okb.LoadOptions = dlo;
     265
     266        return okb.Runs.Where(x => ids.Contains(x.Id)).Select(x => Convert.ToDto(x, includeBinaryValues, valueNames)).ToArray();
     267      }
     268    }
     269
     270    public IEnumerable<DataTransfer.ValueName> GetValueNames() {
     271      using (OKBDataContext okb = new OKBDataContext()) {
     272        return okb.ValueNames.Select(x => Convert.ToDto(x)).ToArray();
     273      }
     274    }
     275
    260276    private IQueryable<DataAccess.Run> FilterRuns(IQueryable<DataAccess.Run> runs, Filter filter) {
    261277      IFilter f = (IFilter)Activator.CreateInstance(Type.GetType(filter.FilterTypeName), filter);
Note: See TracChangeset for help on using the changeset viewer.