Changeset 33 for trunk/Application


Ignore:
Timestamp:
Nov 24, 2011, 1:45:12 PM (13 years ago)
Author:
chronos
Message:
  • Modified: ChronisClient now use concept of object proxies. Methods of TObjectProxy and TListProxy is directed through TChronisClient and descendands implementing different protocols and access methods.
Location:
trunk/Application
Files:
1 added
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/UChronisClient.pas

    r28 r33  
    1313  TOrderDirection = (odNone, odAscending, odDescending);
    1414
    15   { TQuery }
     15  { TObjectProxy }
    1616
    17   TQuery = class
     17  TObjectProxy = class
     18    Id: Integer;
     19    Properties: TDictionaryStringString;
     20    Client: TChronisClient;
     21    procedure Load;
     22    procedure Save;
     23    procedure Delete;
     24    procedure Add;
     25    constructor Create;
     26    destructor Destroy; override;
     27  end;
     28
     29  { TListProxy }
     30
     31  TListProxy = class
    1832    Client: TChronisClient;
    1933    OrderColumn: string;
     
    2539    ColumnsFilter: TListString;
    2640    ColummsFilterUse: Boolean;
     41    ConditionColumn: string;
     42    ConditionValue: string;
     43    ConditionUse: Boolean;
     44    ObjectName: string;
     45    Objects: TListObject; // TListObject<TObjectProxy>
     46    procedure Clear;
    2747    constructor Create;
    2848    destructor Destroy; override;
    29     procedure Execute; virtual;
    30   end;
    31 
    32   TItemList = class(TListObject) // TListObject<TDictionaryStringString>
    33 
     49    procedure Load; virtual;
     50    procedure Save; virtual;
    3451  end;
    3552
     
    3754
    3855  TChronisClient = class
    39     //procedure GetItemList(Model: string; Condition: TCondition; ItemList: TItemList); virtual; abstract;
    40     //procedure SetItemList(Model: string; Condition: TCondition; ItemList: TItemList); virtual; abstract;
     56    Host: string;
     57    Port: Word;
     58    Schema: string;
     59    User: string;
     60    Password: string;
     61    procedure ObjectLoad(AObject: TObjectProxy); virtual; abstract;
     62    procedure ObjectSave(AObject: TObjectProxy); virtual; abstract;
     63    procedure ObjectAdd(AObject: TObjectProxy); virtual; abstract;
     64    procedure ObjectDelete(AObject: TObjectProxy); virtual; abstract;
     65    procedure ListLoad(AList: TListProxy); virtual; abstract;
     66    procedure ListSave(AList: TListProxy); virtual; abstract;
    4167    constructor Create; virtual;
    4268  end;
     
    4470implementation
    4571
    46 { TQuery }
     72{ TObjectProxy }
    4773
    48 constructor TQuery.Create;
     74procedure TObjectProxy.Load;
    4975begin
    50 
     76  Client.ObjectLoad(Self);
    5177end;
    5278
    53 destructor TQuery.Destroy;
     79procedure TObjectProxy.Save;
    5480begin
     81  Client.ObjectSave(Self);
     82end;
     83
     84procedure TObjectProxy.Delete;
     85begin
     86  Client.ObjectDelete(Self);
     87end;
     88
     89procedure TObjectProxy.Add;
     90begin
     91  Client.ObjectAdd(Self);
     92end;
     93
     94constructor TObjectProxy.Create;
     95begin
     96  Properties := TDictionaryStringString.Create;
     97end;
     98
     99destructor TObjectProxy.Destroy;
     100begin
     101  Properties.Free;
    55102  inherited Destroy;
    56103end;
    57104
    58 procedure TQuery.Execute;
     105{ TListProxy }
     106
     107procedure TListProxy.Clear;
    59108begin
     109  ConditionUse := False;
     110  PageUse := False;
     111  ColummsFilterUse := False;
     112  OrderUse := False;
     113  Objects.Free;
     114end;
    60115
     116constructor TListProxy.Create;
     117begin
     118  ColumnsFilter := TListString.Create;
     119  Objects := TListObject.Create;
     120end;
     121
     122destructor TListProxy.Destroy;
     123begin
     124  Objects.Free;
     125  ColumnsFilter.Free;
     126  inherited Destroy;
     127end;
     128
     129procedure TListProxy.Load;
     130begin
     131  Client.ListLoad(Self);
     132end;
     133
     134procedure TListProxy.Save;
     135begin
     136  Client.ListSave(Self);
    61137end;
    62138
Note: See TracChangeset for help on using the changeset viewer.