Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/31/11 18:15:15 (13 years ago)
Author:
cneumuel
Message:

#1233

  • single sign on with HL
  • local plugins are uploaded if not available online (user can force the useage of local plugins)
  • changed plugin and plugindata db-schema
  • plugin dao tests
Location:
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Convert.cs

    r5375 r5402  
    6767        target.JobState = source.JobState;
    6868        target.UserId = source.UserId;
    69         //        target.RequiredPlugins = db.Plugins.Select(x => source.PluginsNeededIds.Contains(x.PluginId)); - this is difficult
     69        // RequiredPlugins need to be added by Dao
    7070      }
    7171    }
     
    109109    public static DT.Plugin ToDto(Plugin source) {
    110110      if (source == null) return null;
    111       return new DT.Plugin { Id = source.PluginId, Name = source.Name, Version = new Version(source.Version) };
     111      return new DT.Plugin { Id = source.PluginId, Name = source.Name, Version = new Version(source.Version), UserId = source.UserId, IsLocal = source.IsLocal, DateCreated = source.DateCreated };
    112112    }
    113113    public static Plugin ToEntity(DT.Plugin source) {
     
    118118    public static void ToEntity(DT.Plugin source, Plugin target) {
    119119      if ((source != null) && (target != null)) {
    120         target.PluginId = source.Id; target.Name = source.Name; target.Version = source.Version.ToString();
     120        target.PluginId = source.Id; target.Name = source.Name; target.Version = source.Version.ToString(); target.UserId = source.UserId; target.IsLocal = source.IsLocal; target.DateCreated = source.DateCreated;
    121121      }
    122122    }
     
    126126    public static DT.PluginData ToDto(PluginData source) {
    127127      if (source == null) return null;
    128       return new DT.PluginData { PluginId = source.PluginId, Data = source.Data.ToArray(), FileName = source.FileName, PluginDataId = source.PluginDataId };
     128      return new DT.PluginData { Id = source.PluginDataId, PluginId = source.PluginId, Data = source.Data.ToArray(), FileName = source.FileName };
    129129    }
    130130    public static PluginData ToEntity(DT.PluginData source) {
     
    135135    public static void ToEntity(DT.PluginData source, PluginData target) {
    136136      if ((source != null) && (target != null)) {
    137         target.PluginId = source.PluginId; target.Data = new Binary(source.Data);
    138         target.FileName = target.FileName;
     137        target.PluginDataId = source.Id; target.PluginId = source.PluginId; target.Data = new Binary(source.Data); target.FileName = source.FileName;
    139138      }
    140139    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HeuristicLab.Services.Hive.DataAccess-3.4.csproj

    r5264 r5402  
    3737  <PropertyGroup>
    3838    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
     39  </PropertyGroup>
     40  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
     41    <DebugSymbols>true</DebugSymbols>
     42    <OutputPath>bin\x86\Debug\</OutputPath>
     43    <DefineConstants>DEBUG;TRACE</DefineConstants>
     44    <DebugType>full</DebugType>
     45    <PlatformTarget>x86</PlatformTarget>
     46    <CodeAnalysisLogFile>bin\Debug\HeuristicLab.Services.Hive.DataAccess-3.4.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
     47    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
     48    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
     49    <ErrorReport>prompt</ErrorReport>
     50    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
     51    <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
     52    <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
     53    <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
     54    <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
     55  </PropertyGroup>
     56  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
     57    <OutputPath>bin\x86\Release\</OutputPath>
     58    <DefineConstants>TRACE</DefineConstants>
     59    <Optimize>true</Optimize>
     60    <DebugType>pdbonly</DebugType>
     61    <PlatformTarget>x86</PlatformTarget>
     62    <CodeAnalysisLogFile>bin\Release\HeuristicLab.Services.Hive.DataAccess-3.4.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
     63    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
     64    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
     65    <ErrorReport>prompt</ErrorReport>
     66    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
     67    <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
     68    <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
     69    <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
     70    <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
    3971  </PropertyGroup>
    4072  <ItemGroup>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs

    r5375 r5402  
    5656        db.Jobs.InsertOnSubmit(entity);
    5757        db.SubmitChanges();
     58        foreach (Guid pluginId in dto.PluginsNeededIds) {
     59          db.RequiredPlugins.InsertOnSubmit(new RequiredPlugin() { JobId = entity.JobId, PluginId = pluginId });
     60        }
     61        db.SubmitChanges();
    5862        return entity.JobId;
    5963      }
     
    6569        if (entity == null) db.Jobs.InsertOnSubmit(Convert.ToEntity(dto));
    6670        else Convert.ToEntity(dto, entity);
     71        // todo: update required plugins
    6772        db.SubmitChanges();
    6873      }
     
    232237    public DT.PluginData GetPluginData(Guid id) {
    233238      using (var db = CreateContext()) {
    234         return Convert.ToDto(db.PluginDatas.SingleOrDefault(x => x.PluginId == id));
     239        return Convert.ToDto(db.PluginDatas.SingleOrDefault(x => x.PluginDataId == id));
    235240      }
    236241    }
     
    247252        db.PluginDatas.InsertOnSubmit(entity);
    248253        db.SubmitChanges();
    249         return entity.PluginId;
     254        return entity.PluginDataId;
    250255      }
    251256    }
     
    262267    public void DeletePluginData(Guid id) {
    263268      using (var db = CreateContext()) {
    264         var entity = db.PluginDatas.FirstOrDefault(x => x.PluginId == id); // check if all the byte[] is loaded into memory here. otherwise work around to delete without loading it
     269        var entity = db.PluginDatas.FirstOrDefault(x => x.PluginDataId == id); // todo: check if all the byte[] is loaded into memory here. otherwise work around to delete without loading it
    265270        if (entity != null) db.PluginDatas.DeleteOnSubmit(entity);
    266271        db.SubmitChanges();
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml

    r5375 r5402  
    1414      <Column Name="Name" Type="System.String" DbType="VarChar(MAX)" CanBeNull="false" />
    1515      <Column Name="Version" Type="System.String" DbType="VarChar(MAX)" CanBeNull="false" />
     16      <Column Name="IsLocal" Type="System.Boolean" DbType="Bit" CanBeNull="false" />
     17      <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" />
     18      <Column Name="DateCreated" Type="System.DateTime" DbType="DateTime" CanBeNull="false" />
    1619      <Association Name="Plugin_RequiredPlugin" Member="RequiredPlugins" ThisKey="PluginId" OtherKey="PluginId" Type="RequiredPlugin" />
    1720      <Association Name="Plugin_PluginData" Member="PluginData" ThisKey="PluginId" OtherKey="PluginId" Type="PluginData" />
     
    7780  <Table Name="dbo.UptimeCalendar" Member="UptimeCalendars">
    7881    <Type Name="UptimeCalendar">
    79       <Column Name="UptimeCalendarId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
    80       <Column Name="ResourceId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
    81       <Column Name="StartDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
    82       <Column Name="EndDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
    83       <Column Name="AllDayEvent" Type="System.Boolean" DbType="Bit NOT NULL" CanBeNull="false" />
    84       <Column Name="Recurring" Type="System.Boolean" DbType="Bit NOT NULL" CanBeNull="false" />
     82      <Column Name="UptimeCalendarId" Type="System.Guid" DbType="UniqueIdentifier" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
     83      <Column Name="ResourceId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" />
     84      <Column Name="StartDate" Type="System.DateTime" DbType="DateTime" CanBeNull="false" />
     85      <Column Name="EndDate" Type="System.DateTime" DbType="DateTime" CanBeNull="false" />
     86      <Column Name="AllDayEvent" Type="System.Boolean" DbType="Bit" CanBeNull="false" />
     87      <Column Name="Recurring" Type="System.Boolean" DbType="Bit" CanBeNull="false" />
    8588      <Column Name="RecurringId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" />
    8689      <Association Name="Resource_UptimeCalendar" Member="Resource" ThisKey="ResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" DeleteRule="CASCADE" />
     
    109112  <Table Name="" Member="PluginDatas">
    110113    <Type Name="PluginData">
     114      <Column Name="PluginDataId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
    111115      <Column Name="PluginId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
    112116      <Column Name="Data" Type="System.Data.Linq.Binary" DbType="VarBinary(MAX) NOT NULL" CanBeNull="false" UpdateCheck="Never" />
    113117      <Column Name="FileName" Type="System.String" DbType="VarChar(MAX)" CanBeNull="false" />
    114       <Column Name="PluginDataId" Type="System.Int32" DbType="Int IDENTITY(1,1)" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
    115118      <Association Name="Plugin_PluginData" Member="Plugin" ThisKey="PluginId" OtherKey="PluginId" Type="Plugin" IsForeignKey="true" />
    116119    </Type>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout

    r5375 r5402  
    99      </nestedChildShapes>
    1010    </classShape>
    11     <classShape Id="7d998e56-4fba-41ca-a1a8-1dcdb9068edf" absoluteBounds="9, 5.5, 2, 1.3862939453125005">
     11    <classShape Id="7d998e56-4fba-41ca-a1a8-1dcdb9068edf" absoluteBounds="9, 5.5, 2, 1.9631982421874996">
    1212      <DataClassMoniker Name="/HiveDataContext/Plugin" />
    1313      <nestedChildShapes>
    14         <elementListCompartment Id="ec4ba325-6dff-4418-baad-59af81ae2024" absoluteBounds="9.015, 5.9600000000000009, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     14        <elementListCompartment Id="ec4ba325-6dff-4418-baad-59af81ae2024" absoluteBounds="9.015, 5.9600000000000009, 1.9700000000000002, 1.4031982421875" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
    1515      </nestedChildShapes>
    1616    </classShape>
     
    130130      </nestedChildShapes>
    131131    </classShape>
    132     <associationConnector edgePoints="[(11 : 6.19314697265625); (11.625 : 6.19314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     132    <associationConnector edgePoints="[(11 : 6.28929768880208); (11.625 : 6.28929768880208)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    133133      <AssociationMoniker Name="/HiveDataContext/Plugin/Plugin_PluginData" />
    134134      <nodes>
     
    144144      </nodes>
    145145    </associationConnector>
    146     <associationConnector edgePoints="[(9 : 6.19314697265625); (8.5 : 6.19314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     146    <associationConnector edgePoints="[(9 : 6.19314697265625); (8.5 : 6.19314697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    147147      <AssociationMoniker Name="/HiveDataContext/Plugin/Plugin_RequiredPlugin" />
    148148      <nodes>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.designer.cs

    r5375 r5402  
    361361    private string _Version;
    362362   
     363    private bool _IsLocal;
     364   
     365    private System.Guid _UserId;
     366   
     367    private System.DateTime _DateCreated;
     368   
    363369    private EntitySet<RequiredPlugin> _RequiredPlugins;
    364370   
     
    375381    partial void OnVersionChanging(string value);
    376382    partial void OnVersionChanged();
     383    partial void OnIsLocalChanging(bool value);
     384    partial void OnIsLocalChanged();
     385    partial void OnUserIdChanging(System.Guid value);
     386    partial void OnUserIdChanged();
     387    partial void OnDateCreatedChanging(System.DateTime value);
     388    partial void OnDateCreatedChanged();
    377389    #endregion
    378390   
     
    440452          this.SendPropertyChanged("Version");
    441453          this.OnVersionChanged();
     454        }
     455      }
     456    }
     457   
     458    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsLocal", DbType="Bit")]
     459    public bool IsLocal
     460    {
     461      get
     462      {
     463        return this._IsLocal;
     464      }
     465      set
     466      {
     467        if ((this._IsLocal != value))
     468        {
     469          this.OnIsLocalChanging(value);
     470          this.SendPropertyChanging();
     471          this._IsLocal = value;
     472          this.SendPropertyChanged("IsLocal");
     473          this.OnIsLocalChanged();
     474        }
     475      }
     476    }
     477   
     478    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", DbType="UniqueIdentifier")]
     479    public System.Guid UserId
     480    {
     481      get
     482      {
     483        return this._UserId;
     484      }
     485      set
     486      {
     487        if ((this._UserId != value))
     488        {
     489          this.OnUserIdChanging(value);
     490          this.SendPropertyChanging();
     491          this._UserId = value;
     492          this.SendPropertyChanged("UserId");
     493          this.OnUserIdChanged();
     494        }
     495      }
     496    }
     497   
     498    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DateCreated", DbType="DateTime")]
     499    public System.DateTime DateCreated
     500    {
     501      get
     502      {
     503        return this._DateCreated;
     504      }
     505      set
     506      {
     507        if ((this._DateCreated != value))
     508        {
     509          this.OnDateCreatedChanging(value);
     510          this.SendPropertyChanging();
     511          this._DateCreated = value;
     512          this.SendPropertyChanged("DateCreated");
     513          this.OnDateCreatedChanged();
    442514        }
    443515      }
     
    18351907    }
    18361908   
    1837     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UptimeCalendarId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
     1909    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UptimeCalendarId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier", IsPrimaryKey=true, IsDbGenerated=true)]
    18381910    public System.Guid UptimeCalendarId
    18391911    {
     
    18551927    }
    18561928   
    1857     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceId", DbType="UniqueIdentifier NOT NULL")]
     1929    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceId", DbType="UniqueIdentifier")]
    18581930    public System.Guid ResourceId
    18591931    {
     
    18791951    }
    18801952   
    1881     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartDate", DbType="DateTime NOT NULL")]
     1953    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StartDate", DbType="DateTime")]
    18821954    public System.DateTime StartDate
    18831955    {
     
    18991971    }
    19001972   
    1901     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EndDate", DbType="DateTime NOT NULL")]
     1973    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_EndDate", DbType="DateTime")]
    19021974    public System.DateTime EndDate
    19031975    {
     
    19191991    }
    19201992   
    1921     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AllDayEvent", DbType="Bit NOT NULL")]
     1993    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AllDayEvent", DbType="Bit")]
    19221994    public bool AllDayEvent
    19231995    {
     
    19392011    }
    19402012   
    1941     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Recurring", DbType="Bit NOT NULL")]
     2013    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Recurring", DbType="Bit")]
    19422014    public bool Recurring
    19432015    {
     
    24222494    private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
    24232495   
     2496    private System.Guid _PluginDataId;
     2497   
    24242498    private System.Guid _PluginId;
    24252499   
     
    24272501   
    24282502    private string _FileName;
    2429    
    2430     private int _PluginDataId;
    24312503   
    24322504    private EntityRef<Plugin> _Plugin;
     
    24362508    partial void OnValidate(System.Data.Linq.ChangeAction action);
    24372509    partial void OnCreated();
     2510    partial void OnPluginDataIdChanging(System.Guid value);
     2511    partial void OnPluginDataIdChanged();
    24382512    partial void OnPluginIdChanging(System.Guid value);
    24392513    partial void OnPluginIdChanged();
     
    24422516    partial void OnFileNameChanging(string value);
    24432517    partial void OnFileNameChanged();
    2444     partial void OnPluginDataIdChanging(int value);
    2445     partial void OnPluginDataIdChanged();
    24462518    #endregion
    24472519   
     
    24502522      this._Plugin = default(EntityRef<Plugin>);
    24512523      OnCreated();
     2524    }
     2525   
     2526    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PluginDataId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
     2527    public System.Guid PluginDataId
     2528    {
     2529      get
     2530      {
     2531        return this._PluginDataId;
     2532      }
     2533      set
     2534      {
     2535        if ((this._PluginDataId != value))
     2536        {
     2537          this.OnPluginDataIdChanging(value);
     2538          this.SendPropertyChanging();
     2539          this._PluginDataId = value;
     2540          this.SendPropertyChanged("PluginDataId");
     2541          this.OnPluginDataIdChanged();
     2542        }
     2543      }
    24522544    }
    24532545   
     
    25162608    }
    25172609   
    2518     [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PluginDataId", AutoSync=AutoSync.OnInsert, DbType="Int IDENTITY(1,1)", IsPrimaryKey=true, IsDbGenerated=true)]
    2519     public int PluginDataId
    2520     {
    2521       get
    2522       {
    2523         return this._PluginDataId;
    2524       }
    2525       set
    2526       {
    2527         if ((this._PluginDataId != value))
    2528         {
    2529           this.OnPluginDataIdChanging(value);
    2530           this.SendPropertyChanging();
    2531           this._PluginDataId = value;
    2532           this.SendPropertyChanged("PluginDataId");
    2533           this.OnPluginDataIdChanged();
    2534         }
    2535       }
    2536     }
    2537    
    25382610    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Plugin_PluginData", Storage="_Plugin", ThisKey="PluginId", OtherKey="PluginId", IsForeignKey=true)]
    25392611    public Plugin Plugin
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/prepareHiveDatabase.sql

    r5106 r5402  
    4343ALTER TABLE dbo.Plugin ALTER COLUMN PluginId ADD ROWGUIDCOL;
    4444ALTER TABLE dbo.Plugin WITH NOCHECK ADD CONSTRAINT [DF_Plugin_PluginId] DEFAULT (newid()) FOR PluginId;
     45
     46ALTER TABLE dbo.PluginData ALTER COLUMN PluginDataId ADD ROWGUIDCOL;
     47ALTER TABLE dbo.PluginData WITH NOCHECK ADD CONSTRAINT [DF_PluginData_PluginDataId] DEFAULT (newid()) FOR PluginDataId;
    4548
    4649ALTER TABLE dbo.RequiredPlugins ALTER COLUMN RequiredPluginId ADD ROWGUIDCOL;
Note: See TracChangeset for help on using the changeset viewer.