1 unit v4sample;
2 {$MODE objfpc}
3 {$H+}
4
5 interface
6
7 uses sysutils, classes, fpjson, restbase, odatabase, odataservice;
8
9 (*
10 Options used to generate:
11 OData version : ODataV4
12 BasecomplexType : TODataObject
13 BaseEntityType : TODataEntity
14 BaseEntityContainerType : TODataEntityContainer
15 BaseServiceType : TODataService
16 BaseEntitySetType : TODataEntitySet
17 Aliases[0] : Microsoft.OData.SampleService.Models.TripPin=
18 SchemaAncestor : TObject
19 FieldPrefix : F
20 ServiceSuffix :
21 EnumerationMode : emScoped
22 *)
23 type
24 // Needed for binary data
25 TByteArray = Array of byte;
26 TInt16Array = Array of SmallInt;
27 //
28 TCity = class;
29 TCityArray = Array of TCity;
30 TLocation = class;
31 TLocationArray = Array of TLocation;
32 TEventLocation = class;
33 TEventLocationArray = Array of TEventLocation;
34 TAirportLocation = class;
35 TAirportLocationArray = Array of TAirportLocation;
36 TPhoto = class;
37 TPhotoArray = Array of TPhoto;
38 TPerson = class;
39 TPersonArray = Array of TPerson;
40 TAirline = class;
41 TAirlineArray = Array of TAirline;
42 TAirport = class;
43 TAirportArray = Array of TAirport;
44 TPlanItem = class;
45 TPlanItemArray = Array of TPlanItem;
46 TPublicTransportation = class;
47 TPublicTransportationArray = Array of TPublicTransportation;
48 TFlight = class;
49 TFlightArray = Array of TFlight;
50 TEvent = class;
51 TEventArray = Array of TEvent;
52 TTrip = class;
53 TTripArray = Array of TTrip;
54 TDefaultContainer = class;
55 TDefaultContainerArray = Array of TDefaultContainer;
56 TPhotosEntitySet = class;
57 TPhotosEntitySetArray = Array of TPhotosEntitySet;
58 TPeopleEntitySet = class;
59 TPeopleEntitySetArray = Array of TPeopleEntitySet;
60 TAirlinesEntitySet = class;
61 TAirlinesEntitySetArray = Array of TAirlinesEntitySet;
62 TAirportsEntitySet = class;
63 TAirportsEntitySetArray = Array of TAirportsEntitySet;
64 TTripImplicitEntitySet = class;
65 TTripImplicitEntitySetArray = Array of TTripImplicitEntitySet;
66 TPlanItemImplicitEntitySet = class;
67 TPlanItemImplicitEntitySetArray = Array of TPlanItemImplicitEntitySet;
68 TService = class;
69 TServiceArray = Array of TService;
70 //
71
72 // Enumerations
73
74 {$SCOPEDENUMS ON}
75 TPersonGender = (Male,Female,Unknown);
76 TPersonGenderArray = Array of TPersonGender;
77
78 { --------------------------------------------------------------------
79 Microsoft.OData.SampleService.Models.TripPin: City
80 --------------------------------------------------------------------}
81
82 TCity = Class(TODataEntity)
83 private
84 FCountryRegion : string;
85 FName : string;
86 FRegion : string;
87 procedure SetCountryRegion(AIndex: Integer; const AValue: string);
88 procedure SetName(AIndex: Integer; const AValue: string);
89 procedure SetRegion(AIndex: Integer; const AValue: string);
90 public
ObjectRestKindnull91 class function ObjectRestKind : String; Override;
92 published
93 Property CountryRegion : string index 0 read FCountryRegion write SetCountryRegion;
94 Property Name : string index 8 read FName write SetName;
95 Property Region : string index 16 read FRegion write SetRegion;
96 end;
97
98
99 { --------------------------------------------------------------------
100 Microsoft.OData.SampleService.Models.TripPin: Location
101 --------------------------------------------------------------------}
102
103 TLocation = Class(TODataEntity)
104 private
105 FAddress : string;
106 FCity : TCity;
107 procedure SetAddress(AIndex: Integer; const AValue: string);
108 procedure SetCity(AIndex: Integer; const AValue: TCity);
109 public
ObjectRestKindnull110 class function ObjectRestKind : String; Override;
111 published
112 Property Address : string index 0 read FAddress write SetAddress;
113 Property City : TCity index 8 read FCity write SetCity;
114 end;
115
116
117 { --------------------------------------------------------------------
118 Microsoft.OData.SampleService.Models.TripPin: EventLocation
119 --------------------------------------------------------------------}
120
121 TEventLocation = Class(TLocation)
122 private
123 FBuildingInfo : string;
124 procedure SetBuildingInfo(AIndex: Integer; const AValue: string);
125 public
ObjectRestKindnull126 class function ObjectRestKind : String; Override;
127 published
128 Property BuildingInfo : string index 16 read FBuildingInfo write SetBuildingInfo;
129 end;
130
131
132 { --------------------------------------------------------------------
133 Microsoft.OData.SampleService.Models.TripPin: AirportLocation
134 --------------------------------------------------------------------}
135
136 TAirportLocation = Class(TLocation)
137 private
138 FLoc : TGeographyPoint;
139 procedure SetLoc(AIndex: Integer; const AValue: TGeographyPoint);
140 public
ObjectRestKindnull141 class function ObjectRestKind : String; Override;
142 published
143 Property Loc : TGeographyPoint index 16 read FLoc write SetLoc;
144 end;
145
146
147 { --------------------------------------------------------------------
148 Microsoft.OData.SampleService.Models.TripPin: Photo
149 --------------------------------------------------------------------}
150
151 TPhoto = Class(TODataEntity)
152 private
153 FId : int64;
154 FName : string;
155 procedure SetId(AIndex: Integer; const AValue: int64);
156 procedure SetName(AIndex: Integer; const AValue: string);
157 public
ObjectRestKindnull158 class function ObjectRestKind : String; Override;
KeyAsURLPartnull159 function KeyAsURLPart : String; Override;
160 procedure GetStream(AService: TODataService; AContentType: String;
161 AStream: TStream);
162 procedure SetStream(AService: TODataService; AContentType: String;
163 AStream: TStream);
164 published
165 Property Id : int64 index 0 read FId write SetId;
166 Property Name : string index 8 read FName write SetName;
167 end;
168
169
170 { --------------------------------------------------------------------
171 Microsoft.OData.SampleService.Models.TripPin: Person
172 --------------------------------------------------------------------}
173
174 TPerson = Class(TODataEntity)
175 private
176 FUserName : string;
177 FFirstName : string;
178 FLastName : string;
179 FEmails : TStringArray;
180 FAddressInfo : TLocationArray;
181 FGender : TPersonGender;
182 FConcurrency : int64;
183 procedure SetUserName(AIndex: Integer; const AValue: string);
184 procedure SetFirstName(AIndex: Integer; const AValue: string);
185 procedure SetLastName(AIndex: Integer; const AValue: string);
186 procedure SetEmails(AIndex: Integer; const AValue: TStringArray);
187 procedure SetAddressInfo(AIndex: Integer; const AValue: TLocationArray);
188 procedure SetGender(AIndex: Integer; const AValue: TPersonGender);
189 procedure SetConcurrency(AIndex: Integer; const AValue: int64);
190 protected
191 {$IFDEF VER2_6}
192 procedure SetArrayLength(const AName: String; ALength: Longint)
193 ; Override;
194 {$ENDIF VER2_6}
195 public
GetFavoriteAirlinenull196 function GetFavoriteAirline(AService: TODataService) : TAirline;
GetFriendsTripsnull197 function GetFriendsTrips(AService: TODataService; userName: string)
198 : TTripArray;
199 procedure ShareTrip(AService: TODataService; userName: string;
200 tripId: TInt32);
ObjectRestKindnull201 class function ObjectRestKind : String; Override;
KeyAsURLPartnull202 function KeyAsURLPart : String; Override;
Friendsnull203 function Friends(AService: TODataService) : TPeopleEntitySet;
Tripsnull204 function Trips(AService: TODataService) : TTripImplicitEntitySet;
Photonull205 function Photo(AService: TODataService) : TPhoto;
206 published
207 Property UserName : string index 0 read FUserName write SetUserName;
208 Property FirstName : string index 8 read FFirstName write SetFirstName;
209 Property LastName : string index 16 read FLastName write SetLastName;
210 Property Emails : TStringArray index 24 read FEmails write SetEmails;
211 Property AddressInfo : TLocationArray index 32 read FAddressInfo write SetAddressInfo;
212 Property Gender : TPersonGender index 40 read FGender write SetGender;
213 Property Concurrency : int64 index 48 read FConcurrency write SetConcurrency;
214 end;
215
216
217 { --------------------------------------------------------------------
218 Microsoft.OData.SampleService.Models.TripPin: Airline
219 --------------------------------------------------------------------}
220
221 TAirline = Class(TODataEntity)
222 private
223 FAirlineCode : string;
224 FName : string;
225 procedure SetAirlineCode(AIndex: Integer; const AValue: string);
226 procedure SetName(AIndex: Integer; const AValue: string);
227 public
ObjectRestKindnull228 class function ObjectRestKind : String; Override;
KeyAsURLPartnull229 function KeyAsURLPart : String; Override;
230 published
231 Property AirlineCode : string index 0 read FAirlineCode write SetAirlineCode;
232 Property Name : string index 8 read FName write SetName;
233 end;
234
235
236 { --------------------------------------------------------------------
237 Microsoft.OData.SampleService.Models.TripPin: Airport
238 --------------------------------------------------------------------}
239
240 TAirport = Class(TODataEntity)
241 private
242 FIcaoCode : string;
243 FName : string;
244 FIataCode : string;
245 FLocation : TAirportLocation;
246 procedure SetIcaoCode(AIndex: Integer; const AValue: string);
247 procedure SetName(AIndex: Integer; const AValue: string);
248 procedure SetIataCode(AIndex: Integer; const AValue: string);
249 procedure SetLocation(AIndex: Integer; const AValue: TAirportLocation);
250 public
ObjectRestKindnull251 class function ObjectRestKind : String; Override;
KeyAsURLPartnull252 function KeyAsURLPart : String; Override;
253 published
254 Property IcaoCode : string index 0 read FIcaoCode write SetIcaoCode;
255 Property Name : string index 8 read FName write SetName;
256 Property IataCode : string index 16 read FIataCode write SetIataCode;
257 Property Location : TAirportLocation index 24 read FLocation write SetLocation;
258 end;
259
260
261 { --------------------------------------------------------------------
262 Microsoft.OData.SampleService.Models.TripPin: PlanItem
263 --------------------------------------------------------------------}
264
265 TPlanItem = Class(TODataEntity)
266 private
267 FPlanItemId : TInt32;
268 FConfirmationCode : string;
269 FStartsAt : TDateTime;
270 FEndsAt : TDateTime;
271 FDuration : TDuration;
272 procedure SetPlanItemId(AIndex: Integer; const AValue: TInt32);
273 procedure SetConfirmationCode(AIndex: Integer; const AValue: string);
274 procedure SetStartsAt(AIndex: Integer; const AValue: TDateTime);
275 procedure SetEndsAt(AIndex: Integer; const AValue: TDateTime);
276 procedure SetDuration(AIndex: Integer; const AValue: TDuration);
277 public
ObjectRestKindnull278 class function ObjectRestKind : String; Override;
KeyAsURLPartnull279 function KeyAsURLPart : String; Override;
280 published
281 Property PlanItemId : TInt32 index 0 read FPlanItemId write SetPlanItemId;
282 Property ConfirmationCode : string index 8 read FConfirmationCode write SetConfirmationCode;
283 Property StartsAt : TDateTime index 16 read FStartsAt write SetStartsAt;
284 Property EndsAt : TDateTime index 24 read FEndsAt write SetEndsAt;
285 Property Duration : TDuration index 32 read FDuration write SetDuration;
286 end;
287
288
289 { --------------------------------------------------------------------
290 Microsoft.OData.SampleService.Models.TripPin: PublicTransportation
291 --------------------------------------------------------------------}
292
293 TPublicTransportation = Class(TPlanItem)
294 private
295 FSeatNumber : string;
296 procedure SetSeatNumber(AIndex: Integer; const AValue: string);
297 public
ObjectRestKindnull298 class function ObjectRestKind : String; Override;
299 published
300 Property SeatNumber : string index 40 read FSeatNumber write SetSeatNumber;
301 end;
302
303
304 { --------------------------------------------------------------------
305 Microsoft.OData.SampleService.Models.TripPin: Flight
306 --------------------------------------------------------------------}
307
308 TFlight = Class(TPublicTransportation)
309 private
310 FFlightNumber : string;
311 procedure SetFlightNumber(AIndex: Integer; const AValue: string);
312 public
ObjectRestKindnull313 class function ObjectRestKind : String; Override;
Fromnull314 function From(AService: TODataService) : TAirport;
_Tonull315 function _To(AService: TODataService) : TAirport;
Airlinenull316 function Airline(AService: TODataService) : TAirline;
317 published
318 Property FlightNumber : string index 48 read FFlightNumber write SetFlightNumber;
319 end;
320
321
322 { --------------------------------------------------------------------
323 Microsoft.OData.SampleService.Models.TripPin: Event
324 --------------------------------------------------------------------}
325
326 TEvent = Class(TPlanItem)
327 private
328 FDescription : string;
329 FOccursAt : TEventLocation;
330 procedure SetDescription(AIndex: Integer; const AValue: string);
331 procedure SetOccursAt(AIndex: Integer; const AValue: TEventLocation);
332 public
ObjectRestKindnull333 class function ObjectRestKind : String; Override;
334 published
335 Property Description : string index 40 read FDescription write SetDescription;
336 Property OccursAt : TEventLocation index 48 read FOccursAt write SetOccursAt;
337 end;
338
339
340 { --------------------------------------------------------------------
341 Microsoft.OData.SampleService.Models.TripPin: Trip
342 --------------------------------------------------------------------}
343
344 TTrip = Class(TODataEntity)
345 private
346 FTripId : TInt32;
347 FShareId : TGUIDString;
348 FDescription : string;
349 FName : string;
350 FBudget : Single;
351 FStartsAt : TDateTime;
352 FEndsAt : TDateTime;
353 FTags : TStringArray;
354 procedure SetTripId(AIndex: Integer; const AValue: TInt32);
355 procedure SetShareId(AIndex: Integer; const AValue: TGUIDString);
356 procedure SetDescription(AIndex: Integer; const AValue: string);
357 procedure SetName(AIndex: Integer; const AValue: string);
358 procedure SetBudget(AIndex: Integer; const AValue: Single);
359 procedure SetStartsAt(AIndex: Integer; const AValue: TDateTime);
360 procedure SetEndsAt(AIndex: Integer; const AValue: TDateTime);
361 procedure SetTags(AIndex: Integer; const AValue: TStringArray);
362 protected
363 {$IFDEF VER2_6}
364 procedure SetArrayLength(const AName: String; ALength: Longint)
365 ; Override;
366 {$ENDIF VER2_6}
367 public
GetInvolvedPeoplenull368 function GetInvolvedPeople(AService: TODataService) : TPersonArray;
ObjectRestKindnull369 class function ObjectRestKind : String; Override;
KeyAsURLPartnull370 function KeyAsURLPart : String; Override;
Photosnull371 function Photos(AService: TODataService) : TPhotosEntitySet;
PlanItemsnull372 function PlanItems(AService: TODataService) : TPlanItemImplicitEntitySet;
373 published
374 Property TripId : TInt32 index 0 read FTripId write SetTripId;
375 Property ShareId : TGUIDString index 8 read FShareId write SetShareId;
376 Property Description : string index 16 read FDescription write SetDescription;
377 Property Name : string index 24 read FName write SetName;
378 Property Budget : Single index 32 read FBudget write SetBudget;
379 Property StartsAt : TDateTime index 40 read FStartsAt write SetStartsAt;
380 Property EndsAt : TDateTime index 48 read FEndsAt write SetEndsAt;
381 Property Tags : TStringArray index 56 read FTags write SetTags;
382 end;
383
384
385 { --------------------------------------------------------------------
386 Microsoft.OData.SampleService.Models.TripPin: DefaultContainer
387 --------------------------------------------------------------------}
388
389 TDefaultContainer = Class(TODataEntityContainer)
390 private
391 FPhotos : TPhotosEntitySet;
392 FPeople : TPeopleEntitySet;
393 FAirlines : TAirlinesEntitySet;
394 FAirports : TAirportsEntitySet;
395 FMe : TPerson;
GetPhotosnull396 function GetPhotos : TPhotosEntitySet;
GetPeoplenull397 function GetPeople : TPeopleEntitySet;
GetAirlinesnull398 function GetAirlines : TAirlinesEntitySet;
GetAirportsnull399 function GetAirports : TAirportsEntitySet;
GetMenull400 function GetMe : TPerson;
401 public
ObjectRestKindnull402 class function ObjectRestKind : String; Override;
CreateNewPhotosnull403 function CreateNewPhotos : TPhotosEntitySet;
CreateNewPeoplenull404 function CreateNewPeople : TPeopleEntitySet;
CreateNewAirlinesnull405 function CreateNewAirlines : TAirlinesEntitySet;
CreateNewAirportsnull406 function CreateNewAirports : TAirportsEntitySet;
FetchMenull407 function FetchMe : TPerson;
408 procedure ResetDataSource;
GetNearestAirportnull409 function GetNearestAirport(lat: Double; lon: Double) : TAirport;
410 published
411 Property Photos : TPhotosEntitySet read GetPhotos;
412 Property People : TPeopleEntitySet read GetPeople;
413 Property Airlines : TAirlinesEntitySet read GetAirlines;
414 Property Airports : TAirportsEntitySet read GetAirports;
415 Property Me : TPerson read GetMe;
416 end;
417
418
419 { --------------------------------------------------------------------
420 Microsoft.OData.SampleService.Models.TripPin: Photos
421 --------------------------------------------------------------------}
422
423 TPhotosEntitySet = Class(TODataEntitySet)
424 public
ObjectRestKindnull425 class function ObjectRestKind : String; Override;
EntityClassnull426 class function EntityClass : TODataEntityClass; Override;
Getnull427 function Get(const Id: int64) : TPhoto;
Listnull428 function List(const AQuery: String; out NextLink: String) : TPhotoArray;
Listnull429 function List(const AQuery: TQueryParams; out NextLink: String)
430 : TPhotoArray;
ListAllnull431 function ListAll(const AQuery: String) : TPhotoArray;
ListAllnull432 function ListAll(const AQuery: TQueryParams) : TPhotoArray;
433 end;
434
435
436 { --------------------------------------------------------------------
437 Microsoft.OData.SampleService.Models.TripPin: People
438 --------------------------------------------------------------------}
439
440 TPeopleEntitySet = Class(TODataEntitySet)
441 public
ObjectRestKindnull442 class function ObjectRestKind : String; Override;
EntityClassnull443 class function EntityClass : TODataEntityClass; Override;
Getnull444 function Get(const UserName: string) : TPerson;
Listnull445 function List(const AQuery: String; out NextLink: String) : TPersonArray;
Listnull446 function List(const AQuery: TQueryParams; out NextLink: String)
447 : TPersonArray;
ListAllnull448 function ListAll(const AQuery: String) : TPersonArray;
ListAllnull449 function ListAll(const AQuery: TQueryParams) : TPersonArray;
450 end;
451
452
453 { --------------------------------------------------------------------
454 Microsoft.OData.SampleService.Models.TripPin: Airlines
455 --------------------------------------------------------------------}
456
457 TAirlinesEntitySet = Class(TODataEntitySet)
458 public
ObjectRestKindnull459 class function ObjectRestKind : String; Override;
EntityClassnull460 class function EntityClass : TODataEntityClass; Override;
Getnull461 function Get(const AirlineCode: string) : TAirline;
Listnull462 function List(const AQuery: String; out NextLink: String)
463 : TAirlineArray;
Listnull464 function List(const AQuery: TQueryParams; out NextLink: String)
465 : TAirlineArray;
ListAllnull466 function ListAll(const AQuery: String) : TAirlineArray;
ListAllnull467 function ListAll(const AQuery: TQueryParams) : TAirlineArray;
468 end;
469
470
471 { --------------------------------------------------------------------
472 Microsoft.OData.SampleService.Models.TripPin: Airports
473 --------------------------------------------------------------------}
474
475 TAirportsEntitySet = Class(TODataEntitySet)
476 public
ObjectRestKindnull477 class function ObjectRestKind : String; Override;
EntityClassnull478 class function EntityClass : TODataEntityClass; Override;
Getnull479 function Get(const IcaoCode: string) : TAirport;
Listnull480 function List(const AQuery: String; out NextLink: String)
481 : TAirportArray;
Listnull482 function List(const AQuery: TQueryParams; out NextLink: String)
483 : TAirportArray;
ListAllnull484 function ListAll(const AQuery: String) : TAirportArray;
ListAllnull485 function ListAll(const AQuery: TQueryParams) : TAirportArray;
486 end;
487
488
489 { --------------------------------------------------------------------
490 Microsoft.OData.SampleService.Models.TripPin: TripImplicitEntitySet
491 --------------------------------------------------------------------}
492
493 TTripImplicitEntitySet = Class(TODataEntitySet)
494 public
ObjectRestKindnull495 class function ObjectRestKind : String; Override;
EntityClassnull496 class function EntityClass : TODataEntityClass; Override;
Getnull497 function Get(const TripId: TInt32) : TTrip;
Listnull498 function List(const AQuery: String; out NextLink: String) : TTripArray;
Listnull499 function List(const AQuery: TQueryParams; out NextLink: String)
500 : TTripArray;
ListAllnull501 function ListAll(const AQuery: String) : TTripArray;
ListAllnull502 function ListAll(const AQuery: TQueryParams) : TTripArray;
503 end;
504
505
506 { --------------------------------------------------------------------
507 Microsoft.OData.SampleService.Models.TripPin: PlanItemImplicitEntitySet
508 --------------------------------------------------------------------}
509
510 TPlanItemImplicitEntitySet = Class(TODataEntitySet)
511 public
ObjectRestKindnull512 class function ObjectRestKind : String; Override;
EntityClassnull513 class function EntityClass : TODataEntityClass; Override;
Getnull514 function Get(const PlanItemId: TInt32) : TPlanItem;
Listnull515 function List(const AQuery: String; out NextLink: String)
516 : TPlanItemArray;
Listnull517 function List(const AQuery: TQueryParams; out NextLink: String)
518 : TPlanItemArray;
ListAllnull519 function ListAll(const AQuery: String) : TPlanItemArray;
ListAllnull520 function ListAll(const AQuery: TQueryParams) : TPlanItemArray;
521 end;
522
523
524 { --------------------------------------------------------------------
525 Microsoft.OData.SampleService.Models.TripPin: Microsoft.OData.SampleService.Models.TripPin
526 --------------------------------------------------------------------}
527
528 TService = Class(TODataService)
529 private
530 FDefaultContainer : TDefaultContainer;
GetDefaultContainernull531 function GetDefaultContainer : TDefaultContainer;
532 public
ObjectRestKindnull533 class function ObjectRestKind : String; Override;
CreateNewDefaultContainernull534 function CreateNewDefaultContainer : TDefaultContainer;
535 published
536 Property DefaultContainer : TDefaultContainer read GetDefaultContainer;
537 end;
538
539
540 implementation
541
542
543 { --------------------------------------------------------------------
544 TCity
545 --------------------------------------------------------------------}
546
547
TCity.ObjectRestKindnull548 Class Function TCity.ObjectRestKind : String;
549
550 begin
551 Result:='City';
552 end;
553
554
555 Procedure TCity.SetCountryRegion(AIndex: Integer; const AValue: string);
556
557
558 begin
559 If (FCountryRegion=AValue) then exit;
560 FCountryRegion:=AValue;
561 MarkPropertyChanged(AIndex);
562 end;
563
564
565 Procedure TCity.SetName(AIndex: Integer; const AValue: string);
566
567
568 begin
569 If (FName=AValue) then exit;
570 FName:=AValue;
571 MarkPropertyChanged(AIndex);
572 end;
573
574
575 Procedure TCity.SetRegion(AIndex: Integer; const AValue: string);
576
577
578 begin
579 If (FRegion=AValue) then exit;
580 FRegion:=AValue;
581 MarkPropertyChanged(AIndex);
582 end;
583
584
585 { --------------------------------------------------------------------
586 TLocation
587 --------------------------------------------------------------------}
588
589
TLocation.ObjectRestKindnull590 Class Function TLocation.ObjectRestKind : String;
591
592 begin
593 Result:='Location';
594 end;
595
596
597 Procedure TLocation.SetAddress(AIndex: Integer; const AValue: string);
598
599
600 begin
601 If (FAddress=AValue) then exit;
602 FAddress:=AValue;
603 MarkPropertyChanged(AIndex);
604 end;
605
606
607 Procedure TLocation.SetCity(AIndex: Integer; const AValue: TCity);
608
609
610 begin
611 If (FCity=AValue) then exit;
612 FCity:=AValue;
613 MarkPropertyChanged(AIndex);
614 end;
615
616
617 { --------------------------------------------------------------------
618 TEventLocation
619 --------------------------------------------------------------------}
620
621
TEventLocation.ObjectRestKindnull622 Class Function TEventLocation.ObjectRestKind : String;
623
624 begin
625 Result:='EventLocation';
626 end;
627
628
629 Procedure TEventLocation.SetBuildingInfo(AIndex: Integer; const AValue: string);
630
631
632 begin
633 If (FBuildingInfo=AValue) then exit;
634 FBuildingInfo:=AValue;
635 MarkPropertyChanged(AIndex);
636 end;
637
638
639 { --------------------------------------------------------------------
640 TAirportLocation
641 --------------------------------------------------------------------}
642
643
TAirportLocation.ObjectRestKindnull644 Class Function TAirportLocation.ObjectRestKind : String;
645
646 begin
647 Result:='AirportLocation';
648 end;
649
650
651 Procedure TAirportLocation.SetLoc(AIndex: Integer; const AValue: TGeographyPoint);
652
653
654 begin
655 If (FLoc=AValue) then exit;
656 FLoc:=AValue;
657 MarkPropertyChanged(AIndex);
658 end;
659
660
661 { --------------------------------------------------------------------
662 TPhoto
663 --------------------------------------------------------------------}
664
665
TPhoto.ObjectRestKindnull666 Class Function TPhoto.ObjectRestKind : String;
667
668 begin
669 Result:='Photo';
670 end;
671
672
673 Procedure TPhoto.SetId(AIndex: Integer; const AValue: int64);
674
675
676 begin
677 If (FId=AValue) then exit;
678 FId:=AValue;
679 MarkPropertyChanged(AIndex);
680 end;
681
682
683 Procedure TPhoto.SetName(AIndex: Integer; const AValue: string);
684
685
686 begin
687 If (FName=AValue) then exit;
688 FName:=AValue;
689 MarkPropertyChanged(AIndex);
690 end;
691
692
TPhoto.KeyAsURLPartnull693 Function TPhoto.KeyAsURLPart : string;
694
695 begin
696 Result:=IntToStr(Id);
697 end;
698
699
700 Procedure TPhoto.GetStream(AService: TODataService; AContentType: String; AStream: TStream);
701
702
703 begin
704 DoGetStream(AService,AContentType,AStream);
705 end;
706
707
708 Procedure TPhoto.SetStream(AService: TODataService; AContentType: String; AStream: TStream);
709
710
711 begin
712 DoSetStream(AService,AContentType,AStream);
713 end;
714
715
716 { --------------------------------------------------------------------
717 TPerson
718 --------------------------------------------------------------------}
719
720
TPerson.GetFavoriteAirlinenull721 Function TPerson.GetFavoriteAirline(AService: TODataService) : TAirline;
722
723 Var
724 _Res : String;
725 _Path : String;
726 begin
727 _Path:='('+_Path+')';
728 _Path:='Microsoft.OData.SampleService.Models.TripPin.GetFavoriteAirline'+_Path;
729 _Path:=BaseURL(AService)+'/'+_Path;
730 Result:=TAirline(AService.SingleServiceCall(_Path,'',TAirline));
731 end;
732
733
TPerson.GetFriendsTripsnull734 Function TPerson.GetFriendsTrips(AService: TODataService; userName: string) : TTripArray;
735
736 Var
737 _Res : String;
738 _Path : String;
739 begin
740 _Path:='userName='+TODataObject.MakeKeyString(userName);
741 _Path:='('+_Path+')';
742 _Path:='Microsoft.OData.SampleService.Models.TripPin.GetFriendsTrips'+_Path;
743 _Path:=BaseURL(AService)+'/'+_Path;
744 Result:=TTripArray(AService.GetMulti(_Path,'',TTrip,True,_Res));
745 end;
746
747
748 Procedure TPerson.ShareTrip(AService: TODataService; userName: string; tripId: TInt32);
749
750 Var
751 _JSON : TJSONObject;
752 _data : String;
753 _Path : String;
754 begin
755 _JSON:=TJSONObject.Create;
756 try
757 _JSON.Add('userName',userName);
758 _JSON.Add('tripId',tripId);
759 _data:=_JSON.AsJSON;
760 finally
761 FreeAndNil(_JSON);
762 end;
763 _Path:=BaseURL(AService)+'/Microsoft.OData.SampleService.Models.TripPin.ShareTrip';
764 AService.ServiceCall('POST',_Path,'',_Data);
765 end;
766
767
TPerson.ObjectRestKindnull768 Class Function TPerson.ObjectRestKind : String;
769
770 begin
771 Result:='Person';
772 end;
773
774
775 Procedure TPerson.SetUserName(AIndex: Integer; const AValue: string);
776
777
778 begin
779 If (FUserName=AValue) then exit;
780 FUserName:=AValue;
781 MarkPropertyChanged(AIndex);
782 end;
783
784
785 Procedure TPerson.SetFirstName(AIndex: Integer; const AValue: string);
786
787
788 begin
789 If (FFirstName=AValue) then exit;
790 FFirstName:=AValue;
791 MarkPropertyChanged(AIndex);
792 end;
793
794
795 Procedure TPerson.SetLastName(AIndex: Integer; const AValue: string);
796
797
798 begin
799 If (FLastName=AValue) then exit;
800 FLastName:=AValue;
801 MarkPropertyChanged(AIndex);
802 end;
803
804
805 Procedure TPerson.SetEmails(AIndex: Integer; const AValue: TStringArray);
806
807
808 begin
809 If (FEmails=AValue) then exit;
810 FEmails:=AValue;
811 MarkPropertyChanged(AIndex);
812 end;
813
814
815 Procedure TPerson.SetAddressInfo(AIndex: Integer; const AValue: TLocationArray);
816
817
818 begin
819 If (FAddressInfo=AValue) then exit;
820 FAddressInfo:=AValue;
821 MarkPropertyChanged(AIndex);
822 end;
823
824
825 Procedure TPerson.SetGender(AIndex: Integer; const AValue: TPersonGender);
826
827
828 begin
829 If (FGender=AValue) then exit;
830 FGender:=AValue;
831 MarkPropertyChanged(AIndex);
832 end;
833
834
835 Procedure TPerson.SetConcurrency(AIndex: Integer; const AValue: int64);
836
837
838 begin
839 If (FConcurrency=AValue) then exit;
840 FConcurrency:=AValue;
841 MarkPropertyChanged(AIndex);
842 end;
843
844 {$IFDEF VER2_6}
845
846 Procedure TPerson.SetArrayLength(const AName: String; ALength: Longint);
847
848 begin
849 Case aName of
850 'emails' : SetLength(FEmails,aLength);
851 'addressinfo' : SetLength(FAddressInfo,aLength);
852 else
853 inherited SetArrayLength(aName,ALength);
854 end;
855 end;
856 {$ENDIF VER2_6}
857
858
TPerson.KeyAsURLPartnull859 Function TPerson.KeyAsURLPart : string;
860
861 begin
862 Result:=TODataObject.MakeKeyString(UserName);
863 end;
864
865
TPerson.Friendsnull866 Function TPerson.Friends(AService: TODataService) : TPeopleEntitySet;
867
868
869 begin
870 Result:=TPeopleEntitySet(CreateContainedEntitySet(AService,'Friends', TPeopleEntitySet));
871 end;
872
873
TPerson.Tripsnull874 Function TPerson.Trips(AService: TODataService) : TTripImplicitEntitySet;
875
876
877 begin
878 Result:=TTripImplicitEntitySet(CreateContainedEntitySet(AService,'Trips', TTripImplicitEntitySet));
879 end;
880
881
TPerson.Photonull882 Function TPerson.Photo(AService: TODataService) : TPhoto;
883
884
885 begin
886 Result:=TPhoto(GetContainedSingleTon(AService,'Photo', TPhoto));
887 end;
888
889
890 { --------------------------------------------------------------------
891 TAirline
892 --------------------------------------------------------------------}
893
894
TAirline.ObjectRestKindnull895 Class Function TAirline.ObjectRestKind : String;
896
897 begin
898 Result:='Airline';
899 end;
900
901
902 Procedure TAirline.SetAirlineCode(AIndex: Integer; const AValue: string);
903
904
905 begin
906 If (FAirlineCode=AValue) then exit;
907 FAirlineCode:=AValue;
908 MarkPropertyChanged(AIndex);
909 end;
910
911
912 Procedure TAirline.SetName(AIndex: Integer; const AValue: string);
913
914
915 begin
916 If (FName=AValue) then exit;
917 FName:=AValue;
918 MarkPropertyChanged(AIndex);
919 end;
920
921
TAirline.KeyAsURLPartnull922 Function TAirline.KeyAsURLPart : string;
923
924 begin
925 Result:=TODataObject.MakeKeyString(AirlineCode);
926 end;
927
928
929 { --------------------------------------------------------------------
930 TAirport
931 --------------------------------------------------------------------}
932
933
TAirport.ObjectRestKindnull934 Class Function TAirport.ObjectRestKind : String;
935
936 begin
937 Result:='Airport';
938 end;
939
940
941 Procedure TAirport.SetIcaoCode(AIndex: Integer; const AValue: string);
942
943
944 begin
945 If (FIcaoCode=AValue) then exit;
946 FIcaoCode:=AValue;
947 MarkPropertyChanged(AIndex);
948 end;
949
950
951 Procedure TAirport.SetName(AIndex: Integer; const AValue: string);
952
953
954 begin
955 If (FName=AValue) then exit;
956 FName:=AValue;
957 MarkPropertyChanged(AIndex);
958 end;
959
960
961 Procedure TAirport.SetIataCode(AIndex: Integer; const AValue: string);
962
963
964 begin
965 If (FIataCode=AValue) then exit;
966 FIataCode:=AValue;
967 MarkPropertyChanged(AIndex);
968 end;
969
970
971 Procedure TAirport.SetLocation(AIndex: Integer; const AValue: TAirportLocation);
972
973
974 begin
975 If (FLocation=AValue) then exit;
976 FLocation:=AValue;
977 MarkPropertyChanged(AIndex);
978 end;
979
980
TAirport.KeyAsURLPartnull981 Function TAirport.KeyAsURLPart : string;
982
983 begin
984 Result:=TODataObject.MakeKeyString(IcaoCode);
985 end;
986
987
988 { --------------------------------------------------------------------
989 TPlanItem
990 --------------------------------------------------------------------}
991
992
TPlanItem.ObjectRestKindnull993 Class Function TPlanItem.ObjectRestKind : String;
994
995 begin
996 Result:='PlanItem';
997 end;
998
999
1000 Procedure TPlanItem.SetPlanItemId(AIndex: Integer; const AValue: TInt32);
1001
1002
1003 begin
1004 If (FPlanItemId=AValue) then exit;
1005 FPlanItemId:=AValue;
1006 MarkPropertyChanged(AIndex);
1007 end;
1008
1009
1010 Procedure TPlanItem.SetConfirmationCode(AIndex: Integer; const AValue: string);
1011
1012
1013 begin
1014 If (FConfirmationCode=AValue) then exit;
1015 FConfirmationCode:=AValue;
1016 MarkPropertyChanged(AIndex);
1017 end;
1018
1019
1020 Procedure TPlanItem.SetStartsAt(AIndex: Integer; const AValue: TDateTime);
1021
1022
1023 begin
1024 If (FStartsAt=AValue) then exit;
1025 FStartsAt:=AValue;
1026 MarkPropertyChanged(AIndex);
1027 end;
1028
1029
1030 Procedure TPlanItem.SetEndsAt(AIndex: Integer; const AValue: TDateTime);
1031
1032
1033 begin
1034 If (FEndsAt=AValue) then exit;
1035 FEndsAt:=AValue;
1036 MarkPropertyChanged(AIndex);
1037 end;
1038
1039
1040 Procedure TPlanItem.SetDuration(AIndex: Integer; const AValue: TDuration);
1041
1042
1043 begin
1044 If (FDuration=AValue) then exit;
1045 FDuration:=AValue;
1046 MarkPropertyChanged(AIndex);
1047 end;
1048
1049
TPlanItem.KeyAsURLPartnull1050 Function TPlanItem.KeyAsURLPart : string;
1051
1052 begin
1053 Result:=IntToStr(PlanItemId);
1054 end;
1055
1056
1057 { --------------------------------------------------------------------
1058 TPublicTransportation
1059 --------------------------------------------------------------------}
1060
1061
TPublicTransportation.ObjectRestKindnull1062 Class Function TPublicTransportation.ObjectRestKind : String;
1063
1064 begin
1065 Result:='PublicTransportation';
1066 end;
1067
1068
1069 Procedure TPublicTransportation.SetSeatNumber(AIndex: Integer; const AValue: string);
1070
1071
1072 begin
1073 If (FSeatNumber=AValue) then exit;
1074 FSeatNumber:=AValue;
1075 MarkPropertyChanged(AIndex);
1076 end;
1077
1078
1079 { --------------------------------------------------------------------
1080 TFlight
1081 --------------------------------------------------------------------}
1082
1083
TFlight.ObjectRestKindnull1084 Class Function TFlight.ObjectRestKind : String;
1085
1086 begin
1087 Result:='Flight';
1088 end;
1089
1090
1091 Procedure TFlight.SetFlightNumber(AIndex: Integer; const AValue: string);
1092
1093
1094 begin
1095 If (FFlightNumber=AValue) then exit;
1096 FFlightNumber:=AValue;
1097 MarkPropertyChanged(AIndex);
1098 end;
1099
1100
TFlight.Fromnull1101 Function TFlight.From(AService: TODataService) : TAirport;
1102
1103
1104 begin
1105 Result:=TAirport(GetContainedSingleTon(AService,'From', TAirport));
1106 end;
1107
1108
TFlight._Tonull1109 Function TFlight._To(AService: TODataService) : TAirport;
1110
1111
1112 begin
1113 Result:=TAirport(GetContainedSingleTon(AService,'To', TAirport));
1114 end;
1115
1116
TFlight.Airlinenull1117 Function TFlight.Airline(AService: TODataService) : TAirline;
1118
1119
1120 begin
1121 Result:=TAirline(GetContainedSingleTon(AService,'Airline', TAirline));
1122 end;
1123
1124
1125 { --------------------------------------------------------------------
1126 TEvent
1127 --------------------------------------------------------------------}
1128
1129
TEvent.ObjectRestKindnull1130 Class Function TEvent.ObjectRestKind : String;
1131
1132 begin
1133 Result:='Event';
1134 end;
1135
1136
1137 Procedure TEvent.SetDescription(AIndex: Integer; const AValue: string);
1138
1139
1140 begin
1141 If (FDescription=AValue) then exit;
1142 FDescription:=AValue;
1143 MarkPropertyChanged(AIndex);
1144 end;
1145
1146
1147 Procedure TEvent.SetOccursAt(AIndex: Integer; const AValue: TEventLocation);
1148
1149
1150 begin
1151 If (FOccursAt=AValue) then exit;
1152 FOccursAt:=AValue;
1153 MarkPropertyChanged(AIndex);
1154 end;
1155
1156
1157 { --------------------------------------------------------------------
1158 TTrip
1159 --------------------------------------------------------------------}
1160
1161
TTrip.GetInvolvedPeoplenull1162 Function TTrip.GetInvolvedPeople(AService: TODataService) : TPersonArray;
1163
1164 Var
1165 _Res : String;
1166 _Path : String;
1167 begin
1168 _Path:='('+_Path+')';
1169 _Path:='Microsoft.OData.SampleService.Models.TripPin.GetInvolvedPeople'+_Path;
1170 _Path:=BaseURL(AService)+'/'+_Path;
1171 Result:=TPersonArray(AService.GetMulti(_Path,'',TPerson,True,_Res));
1172 end;
1173
1174
TTrip.ObjectRestKindnull1175 Class Function TTrip.ObjectRestKind : String;
1176
1177 begin
1178 Result:='Trip';
1179 end;
1180
1181
1182 Procedure TTrip.SetTripId(AIndex: Integer; const AValue: TInt32);
1183
1184
1185 begin
1186 If (FTripId=AValue) then exit;
1187 FTripId:=AValue;
1188 MarkPropertyChanged(AIndex);
1189 end;
1190
1191
1192 Procedure TTrip.SetShareId(AIndex: Integer; const AValue: TGUIDString);
1193
1194
1195 begin
1196 If (FShareId=AValue) then exit;
1197 FShareId:=AValue;
1198 MarkPropertyChanged(AIndex);
1199 end;
1200
1201
1202 Procedure TTrip.SetDescription(AIndex: Integer; const AValue: string);
1203
1204
1205 begin
1206 If (FDescription=AValue) then exit;
1207 FDescription:=AValue;
1208 MarkPropertyChanged(AIndex);
1209 end;
1210
1211
1212 Procedure TTrip.SetName(AIndex: Integer; const AValue: string);
1213
1214
1215 begin
1216 If (FName=AValue) then exit;
1217 FName:=AValue;
1218 MarkPropertyChanged(AIndex);
1219 end;
1220
1221
1222 Procedure TTrip.SetBudget(AIndex: Integer; const AValue: Single);
1223
1224
1225 begin
1226 If (FBudget=AValue) then exit;
1227 FBudget:=AValue;
1228 MarkPropertyChanged(AIndex);
1229 end;
1230
1231
1232 Procedure TTrip.SetStartsAt(AIndex: Integer; const AValue: TDateTime);
1233
1234
1235 begin
1236 If (FStartsAt=AValue) then exit;
1237 FStartsAt:=AValue;
1238 MarkPropertyChanged(AIndex);
1239 end;
1240
1241
1242 Procedure TTrip.SetEndsAt(AIndex: Integer; const AValue: TDateTime);
1243
1244
1245 begin
1246 If (FEndsAt=AValue) then exit;
1247 FEndsAt:=AValue;
1248 MarkPropertyChanged(AIndex);
1249 end;
1250
1251
1252 Procedure TTrip.SetTags(AIndex: Integer; const AValue: TStringArray);
1253
1254
1255 begin
1256 If (FTags=AValue) then exit;
1257 FTags:=AValue;
1258 MarkPropertyChanged(AIndex);
1259 end;
1260
1261 {$IFDEF VER2_6}
1262
1263 Procedure TTrip.SetArrayLength(const AName: String; ALength: Longint);
1264
1265 begin
1266 Case aName of
1267 'tags' : SetLength(FTags,aLength);
1268 else
1269 inherited SetArrayLength(aName,ALength);
1270 end;
1271 end;
1272 {$ENDIF VER2_6}
1273
1274
TTrip.KeyAsURLPartnull1275 Function TTrip.KeyAsURLPart : string;
1276
1277 begin
1278 Result:=IntToStr(TripId);
1279 end;
1280
1281
TTrip.Photosnull1282 Function TTrip.Photos(AService: TODataService) : TPhotosEntitySet;
1283
1284
1285 begin
1286 Result:=TPhotosEntitySet(CreateContainedEntitySet(AService,'Photos', TPhotosEntitySet));
1287 end;
1288
1289
TTrip.PlanItemsnull1290 Function TTrip.PlanItems(AService: TODataService) : TPlanItemImplicitEntitySet;
1291
1292
1293 begin
1294 Result:=TPlanItemImplicitEntitySet(CreateContainedEntitySet(AService,'PlanItems', TPlanItemImplicitEntitySet));
1295 end;
1296
1297
1298 { --------------------------------------------------------------------
1299 TDefaultContainer
1300 --------------------------------------------------------------------}
1301
1302
TDefaultContainer.ObjectRestKindnull1303 Class Function TDefaultContainer.ObjectRestKind : String;
1304
1305 begin
1306 Result:='DefaultContainer';
1307 end;
1308
TDefaultContainer.CreateNewPhotosnull1309 Function TDefaultContainer.CreateNewPhotos : TPhotosEntitySet;
1310
1311 begin
1312 Result:=TPhotosEntitySet(CreateEntitySet(TPhotosEntitySet));
1313 end;
1314
1315
TDefaultContainer.GetPhotosnull1316 Function TDefaultContainer.GetPhotos : TPhotosEntitySet;
1317
1318
1319 begin
1320 If Not Assigned(FPhotos) then
1321 FPhotos:=TPhotosEntitySet(CreateEntitySet(TPhotosEntitySet));
1322 Result:=FPhotos;
1323 end;
1324
TDefaultContainer.CreateNewPeoplenull1325 Function TDefaultContainer.CreateNewPeople : TPeopleEntitySet;
1326
1327 begin
1328 Result:=TPeopleEntitySet(CreateEntitySet(TPeopleEntitySet));
1329 end;
1330
1331
TDefaultContainer.GetPeoplenull1332 Function TDefaultContainer.GetPeople : TPeopleEntitySet;
1333
1334
1335 begin
1336 If Not Assigned(FPeople) then
1337 FPeople:=TPeopleEntitySet(CreateEntitySet(TPeopleEntitySet));
1338 Result:=FPeople;
1339 end;
1340
TDefaultContainer.CreateNewAirlinesnull1341 Function TDefaultContainer.CreateNewAirlines : TAirlinesEntitySet;
1342
1343 begin
1344 Result:=TAirlinesEntitySet(CreateEntitySet(TAirlinesEntitySet));
1345 end;
1346
1347
TDefaultContainer.GetAirlinesnull1348 Function TDefaultContainer.GetAirlines : TAirlinesEntitySet;
1349
1350
1351 begin
1352 If Not Assigned(FAirlines) then
1353 FAirlines:=TAirlinesEntitySet(CreateEntitySet(TAirlinesEntitySet));
1354 Result:=FAirlines;
1355 end;
1356
TDefaultContainer.CreateNewAirportsnull1357 Function TDefaultContainer.CreateNewAirports : TAirportsEntitySet;
1358
1359 begin
1360 Result:=TAirportsEntitySet(CreateEntitySet(TAirportsEntitySet));
1361 end;
1362
1363
TDefaultContainer.GetAirportsnull1364 Function TDefaultContainer.GetAirports : TAirportsEntitySet;
1365
1366
1367 begin
1368 If Not Assigned(FAirports) then
1369 FAirports:=TAirportsEntitySet(CreateEntitySet(TAirportsEntitySet));
1370 Result:=FAirports;
1371 end;
1372
1373
TDefaultContainer.FetchMenull1374 Function TDefaultContainer.FetchMe : TPerson;
1375
1376 begin
1377 CheckService;
1378 Result:=TPerson(Service.SingleServiceCall('Me','',TPerson));
1379 Result.BasePath:='Me';
1380 end;
1381
1382
TDefaultContainer.GetMenull1383 Function TDefaultContainer.GetMe : TPerson;
1384
1385
1386 begin
1387 If Not Assigned(FMe) then
1388 FMe:=FetchMe;
1389 Result:=FMe;
1390 end;
1391
1392
1393 Procedure TDefaultContainer.ResetDataSource;
1394
1395 Var
1396 _data : String;
1397 _Path : String;
1398 begin
1399 CheckService;
1400 _data:='';
1401 _Path:='/ResetDataSource';
1402 Service.ServiceCall('POST',_Path,'',_Data);
1403 end;
1404
1405
TDefaultContainer.GetNearestAirportnull1406 Function TDefaultContainer.GetNearestAirport(lat: Double; lon: Double) : TAirport;
1407
1408 Var
1409 _Res : String;
1410 _Path : String;
1411 begin
1412 CheckService;
1413 _Path:='lat='+FloatToStr(lat);
1414 _Path:=_Path+','+'lon='+FloatToStr(lon);
1415 _Path:='('+_Path+')';
1416 _Path:='GetNearestAirport'+_Path;
1417 Result:=TAirport(Service.SingleServiceCall(_Path,'',TAirport));
1418 end;
1419
1420
1421 { --------------------------------------------------------------------
1422 TPhotosEntitySet
1423 --------------------------------------------------------------------}
1424
1425
TPhotosEntitySet.ObjectRestKindnull1426 Class Function TPhotosEntitySet.ObjectRestKind : String;
1427
1428 begin
1429 Result:='Photos';
1430 end;
1431
TPhotosEntitySet.EntityClassnull1432 Class Function TPhotosEntitySet.EntityClass : TODataEntityClass;
1433
1434 begin
1435 Result:=TPhoto;
1436 end;
1437
1438
TPhotosEntitySet.Getnull1439 Function TPhotosEntitySet.Get(const Id: int64) : TPhoto;
1440
1441
1442 begin
1443 Result:=TPhoto(GetSingle(IntToStr(Id)));
1444 end;
1445
1446
TPhotosEntitySet.Listnull1447 Function TPhotosEntitySet.List(const AQuery: String; out NextLink: String) : TPhotoArray;
1448
1449
1450 begin
1451 Result:=TPhotoArray(GetMulti(AQuery,False,NextLink));
1452 end;
1453
1454
TPhotosEntitySet.Listnull1455 Function TPhotosEntitySet.List(const AQuery: TQueryParams; out NextLink: String) : TPhotoArray;
1456
1457
1458 begin
1459 Result:=TPhotoArray(GetMulti(AQuery,False,NextLink));
1460 end;
1461
1462
TPhotosEntitySet.ListAllnull1463 Function TPhotosEntitySet.ListAll(const AQuery: String) : TPhotoArray;
1464
1465 var N : String;
1466
1467 begin
1468 Result:=TPhotoArray(GetMulti(AQuery,True,N));
1469 end;
1470
1471
TPhotosEntitySet.ListAllnull1472 Function TPhotosEntitySet.ListAll(const AQuery: TQueryParams) : TPhotoArray;
1473
1474 var N : String;
1475
1476 begin
1477 Result:=TPhotoArray(GetMulti(AQuery,True,N));
1478 end;
1479
1480
1481 { --------------------------------------------------------------------
1482 TPeopleEntitySet
1483 --------------------------------------------------------------------}
1484
1485
TPeopleEntitySet.ObjectRestKindnull1486 Class Function TPeopleEntitySet.ObjectRestKind : String;
1487
1488 begin
1489 Result:='People';
1490 end;
1491
TPeopleEntitySet.EntityClassnull1492 Class Function TPeopleEntitySet.EntityClass : TODataEntityClass;
1493
1494 begin
1495 Result:=TPerson;
1496 end;
1497
1498
TPeopleEntitySet.Getnull1499 Function TPeopleEntitySet.Get(const UserName: string) : TPerson;
1500
1501
1502 begin
1503 Result:=TPerson(GetSingle(TODataObject.MakeKeyString(UserName)));
1504 end;
1505
1506
TPeopleEntitySet.Listnull1507 Function TPeopleEntitySet.List(const AQuery: String; out NextLink: String) : TPersonArray;
1508
1509
1510 begin
1511 Result:=TPersonArray(GetMulti(AQuery,False,NextLink));
1512 end;
1513
1514
TPeopleEntitySet.Listnull1515 Function TPeopleEntitySet.List(const AQuery: TQueryParams; out NextLink: String) : TPersonArray;
1516
1517
1518 begin
1519 Result:=TPersonArray(GetMulti(AQuery,False,NextLink));
1520 end;
1521
1522
TPeopleEntitySet.ListAllnull1523 Function TPeopleEntitySet.ListAll(const AQuery: String) : TPersonArray;
1524
1525 var N : String;
1526
1527 begin
1528 Result:=TPersonArray(GetMulti(AQuery,True,N));
1529 end;
1530
1531
TPeopleEntitySet.ListAllnull1532 Function TPeopleEntitySet.ListAll(const AQuery: TQueryParams) : TPersonArray;
1533
1534 var N : String;
1535
1536 begin
1537 Result:=TPersonArray(GetMulti(AQuery,True,N));
1538 end;
1539
1540
1541 { --------------------------------------------------------------------
1542 TAirlinesEntitySet
1543 --------------------------------------------------------------------}
1544
1545
TAirlinesEntitySet.ObjectRestKindnull1546 Class Function TAirlinesEntitySet.ObjectRestKind : String;
1547
1548 begin
1549 Result:='Airlines';
1550 end;
1551
TAirlinesEntitySet.EntityClassnull1552 Class Function TAirlinesEntitySet.EntityClass : TODataEntityClass;
1553
1554 begin
1555 Result:=TAirline;
1556 end;
1557
1558
TAirlinesEntitySet.Getnull1559 Function TAirlinesEntitySet.Get(const AirlineCode: string) : TAirline;
1560
1561
1562 begin
1563 Result:=TAirline(GetSingle(TODataObject.MakeKeyString(AirlineCode)));
1564 end;
1565
1566
TAirlinesEntitySet.Listnull1567 Function TAirlinesEntitySet.List(const AQuery: String; out NextLink: String) : TAirlineArray;
1568
1569
1570 begin
1571 Result:=TAirlineArray(GetMulti(AQuery,False,NextLink));
1572 end;
1573
1574
TAirlinesEntitySet.Listnull1575 Function TAirlinesEntitySet.List(const AQuery: TQueryParams; out NextLink: String) : TAirlineArray;
1576
1577
1578 begin
1579 Result:=TAirlineArray(GetMulti(AQuery,False,NextLink));
1580 end;
1581
1582
TAirlinesEntitySet.ListAllnull1583 Function TAirlinesEntitySet.ListAll(const AQuery: String) : TAirlineArray;
1584
1585 var N : String;
1586
1587 begin
1588 Result:=TAirlineArray(GetMulti(AQuery,True,N));
1589 end;
1590
1591
TAirlinesEntitySet.ListAllnull1592 Function TAirlinesEntitySet.ListAll(const AQuery: TQueryParams) : TAirlineArray;
1593
1594 var N : String;
1595
1596 begin
1597 Result:=TAirlineArray(GetMulti(AQuery,True,N));
1598 end;
1599
1600
1601 { --------------------------------------------------------------------
1602 TAirportsEntitySet
1603 --------------------------------------------------------------------}
1604
1605
TAirportsEntitySet.ObjectRestKindnull1606 Class Function TAirportsEntitySet.ObjectRestKind : String;
1607
1608 begin
1609 Result:='Airports';
1610 end;
1611
TAirportsEntitySet.EntityClassnull1612 Class Function TAirportsEntitySet.EntityClass : TODataEntityClass;
1613
1614 begin
1615 Result:=TAirport;
1616 end;
1617
1618
TAirportsEntitySet.Getnull1619 Function TAirportsEntitySet.Get(const IcaoCode: string) : TAirport;
1620
1621
1622 begin
1623 Result:=TAirport(GetSingle(TODataObject.MakeKeyString(IcaoCode)));
1624 end;
1625
1626
TAirportsEntitySet.Listnull1627 Function TAirportsEntitySet.List(const AQuery: String; out NextLink: String) : TAirportArray;
1628
1629
1630 begin
1631 Result:=TAirportArray(GetMulti(AQuery,False,NextLink));
1632 end;
1633
1634
TAirportsEntitySet.Listnull1635 Function TAirportsEntitySet.List(const AQuery: TQueryParams; out NextLink: String) : TAirportArray;
1636
1637
1638 begin
1639 Result:=TAirportArray(GetMulti(AQuery,False,NextLink));
1640 end;
1641
1642
TAirportsEntitySet.ListAllnull1643 Function TAirportsEntitySet.ListAll(const AQuery: String) : TAirportArray;
1644
1645 var N : String;
1646
1647 begin
1648 Result:=TAirportArray(GetMulti(AQuery,True,N));
1649 end;
1650
1651
TAirportsEntitySet.ListAllnull1652 Function TAirportsEntitySet.ListAll(const AQuery: TQueryParams) : TAirportArray;
1653
1654 var N : String;
1655
1656 begin
1657 Result:=TAirportArray(GetMulti(AQuery,True,N));
1658 end;
1659
1660
1661 { --------------------------------------------------------------------
1662 TTripImplicitEntitySet
1663 --------------------------------------------------------------------}
1664
1665
TTripImplicitEntitySet.ObjectRestKindnull1666 Class Function TTripImplicitEntitySet.ObjectRestKind : String;
1667
1668 begin
1669 Result:='TripImplicitEntitySet';
1670 end;
1671
TTripImplicitEntitySet.EntityClassnull1672 Class Function TTripImplicitEntitySet.EntityClass : TODataEntityClass;
1673
1674 begin
1675 Result:=TTrip;
1676 end;
1677
1678
TTripImplicitEntitySet.Getnull1679 Function TTripImplicitEntitySet.Get(const TripId: TInt32) : TTrip;
1680
1681
1682 begin
1683 Result:=TTrip(GetSingle(IntToStr(TripId)));
1684 end;
1685
1686
TTripImplicitEntitySet.Listnull1687 Function TTripImplicitEntitySet.List(const AQuery: String; out NextLink: String) : TTripArray;
1688
1689
1690 begin
1691 Result:=TTripArray(GetMulti(AQuery,False,NextLink));
1692 end;
1693
1694
TTripImplicitEntitySet.Listnull1695 Function TTripImplicitEntitySet.List(const AQuery: TQueryParams; out NextLink: String) : TTripArray;
1696
1697
1698 begin
1699 Result:=TTripArray(GetMulti(AQuery,False,NextLink));
1700 end;
1701
1702
TTripImplicitEntitySet.ListAllnull1703 Function TTripImplicitEntitySet.ListAll(const AQuery: String) : TTripArray;
1704
1705 var N : String;
1706
1707 begin
1708 Result:=TTripArray(GetMulti(AQuery,True,N));
1709 end;
1710
1711
TTripImplicitEntitySet.ListAllnull1712 Function TTripImplicitEntitySet.ListAll(const AQuery: TQueryParams) : TTripArray;
1713
1714 var N : String;
1715
1716 begin
1717 Result:=TTripArray(GetMulti(AQuery,True,N));
1718 end;
1719
1720
1721 { --------------------------------------------------------------------
1722 TPlanItemImplicitEntitySet
1723 --------------------------------------------------------------------}
1724
1725
TPlanItemImplicitEntitySet.ObjectRestKindnull1726 Class Function TPlanItemImplicitEntitySet.ObjectRestKind : String;
1727
1728 begin
1729 Result:='PlanItemImplicitEntitySet';
1730 end;
1731
TPlanItemImplicitEntitySet.EntityClassnull1732 Class Function TPlanItemImplicitEntitySet.EntityClass : TODataEntityClass;
1733
1734 begin
1735 Result:=TPlanItem;
1736 end;
1737
1738
TPlanItemImplicitEntitySet.Getnull1739 Function TPlanItemImplicitEntitySet.Get(const PlanItemId: TInt32) : TPlanItem;
1740
1741
1742 begin
1743 Result:=TPlanItem(GetSingle(IntToStr(PlanItemId)));
1744 end;
1745
1746
TPlanItemImplicitEntitySet.Listnull1747 Function TPlanItemImplicitEntitySet.List(const AQuery: String; out NextLink: String) : TPlanItemArray;
1748
1749
1750 begin
1751 Result:=TPlanItemArray(GetMulti(AQuery,False,NextLink));
1752 end;
1753
1754
TPlanItemImplicitEntitySet.Listnull1755 Function TPlanItemImplicitEntitySet.List(const AQuery: TQueryParams; out NextLink: String) : TPlanItemArray;
1756
1757
1758 begin
1759 Result:=TPlanItemArray(GetMulti(AQuery,False,NextLink));
1760 end;
1761
1762
TPlanItemImplicitEntitySet.ListAllnull1763 Function TPlanItemImplicitEntitySet.ListAll(const AQuery: String) : TPlanItemArray;
1764
1765 var N : String;
1766
1767 begin
1768 Result:=TPlanItemArray(GetMulti(AQuery,True,N));
1769 end;
1770
1771
TPlanItemImplicitEntitySet.ListAllnull1772 Function TPlanItemImplicitEntitySet.ListAll(const AQuery: TQueryParams) : TPlanItemArray;
1773
1774 var N : String;
1775
1776 begin
1777 Result:=TPlanItemArray(GetMulti(AQuery,True,N));
1778 end;
1779
1780
1781 { --------------------------------------------------------------------
1782 TService
1783 --------------------------------------------------------------------}
1784
1785
TService.ObjectRestKindnull1786 Class Function TService.ObjectRestKind : String;
1787
1788 begin
1789 Result:='Microsoft.OData.SampleService.Models.TripPin';
1790 end;
1791
TService.CreateNewDefaultContainernull1792 Function TService.CreateNewDefaultContainer : TDefaultContainer;
1793
1794 begin
1795 Result:=TDefaultContainer(CreateEntityContainer(TDefaultContainer));
1796 end;
1797
1798
TService.GetDefaultContainernull1799 Function TService.GetDefaultContainer : TDefaultContainer;
1800
1801
1802 begin
1803 If Not Assigned(FDefaultContainer) then
1804 FDefaultContainer:=TDefaultContainer(CreateEntityContainer(TDefaultContainer));
1805 Result:=FDefaultContainer;
1806 end;
1807
1808 end.
1809