Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Operator Architecture Refactoring/HeuristicLab.Hive.Server.ADODataAccess/UserAdapter.cs @ 1584

Last change on this file since 1584 was 845, checked in by svonolfe, 16 years ago

Added user adapter (#372).

File size: 2.5 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Linq;
25using System.Text;
26
27using HeuristicLab.Hive.Server.Core.InternalInterfaces.DataAccess;
28using HeuristicLab.Hive.Contracts.BusinessObjects;
29
30namespace HeuristicLab.Hive.Server.ADODataAccess {
31  class UserAdapter: IUserAdapter {
32    private dsHiveServerTableAdapters.HiveUserTableAdapter adapter =
33        new dsHiveServerTableAdapters.HiveUserTableAdapter();
34
35    private PermissionOwnerAdapter permOwnerAdapter =
36      new PermissionOwnerAdapter();
37
38    private User Convert(dsHiveServer.HiveUserRow row) {
39      if (row != null) {
40        User user = new User();
41
42        /*Parent - resource*/
43        PermissionOwner permOwner =
44          permOwnerAdapter.GetPermissionOwnerById(row.PermissionOwnerId);
45        user.PermissionOwnerId = permOwner.PermissionOwnerId;
46        user.Name = permOwner.Name;
47
48        /*User*/
49        user.Password = row.Password;
50
51        return user;
52      } else
53        return null;
54    }
55
56    private dsHiveServer.HiveUserRow Convert(User user,
57      dsHiveServer.HiveUserRow row) {
58      if (user != null && row != null) {
59        row.PermissionOwnerId = user.PermissionOwnerId;
60        row.Password = user.Password;
61      }
62
63      return row;
64    }
65
66    #region IUserAdapter Members
67
68    public void UpdateUser(User user) {
69      throw new NotImplementedException();
70    }
71
72    public ClientInfo GetUserById(long userId) {
73      throw new NotImplementedException();
74    }
75
76    public ICollection<User> GetAllUsers() {
77      throw new NotImplementedException();
78    }
79
80    public bool DeleteUser(User user) {
81      throw new NotImplementedException();
82    }
83
84    #endregion
85  }
86}
Note: See TracBrowser for help on using the repository browser.