12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808 |
- unit v4sample;
- {$MODE objfpc}
- {$H+}
- interface
- uses sysutils, classes, fpjson, restbase, odatabase, odataservice;
- (*
- Options used to generate:
- OData version : ODataV4
- BasecomplexType : TODataObject
- BaseEntityType : TODataEntity
- BaseEntityContainerType : TODataEntityContainer
- BaseServiceType : TODataService
- BaseEntitySetType : TODataEntitySet
- Aliases[0] : Microsoft.OData.SampleService.Models.TripPin=
- SchemaAncestor : TObject
- FieldPrefix : F
- ServiceSuffix :
- EnumerationMode : emScoped
- *)
- type
- // Needed for binary data
- TByteArray = Array of byte;
- TInt16Array = Array of SmallInt;
- //
- TCity = class;
- TCityArray = Array of TCity;
- TLocation = class;
- TLocationArray = Array of TLocation;
- TEventLocation = class;
- TEventLocationArray = Array of TEventLocation;
- TAirportLocation = class;
- TAirportLocationArray = Array of TAirportLocation;
- TPhoto = class;
- TPhotoArray = Array of TPhoto;
- TPerson = class;
- TPersonArray = Array of TPerson;
- TAirline = class;
- TAirlineArray = Array of TAirline;
- TAirport = class;
- TAirportArray = Array of TAirport;
- TPlanItem = class;
- TPlanItemArray = Array of TPlanItem;
- TPublicTransportation = class;
- TPublicTransportationArray = Array of TPublicTransportation;
- TFlight = class;
- TFlightArray = Array of TFlight;
- TEvent = class;
- TEventArray = Array of TEvent;
- TTrip = class;
- TTripArray = Array of TTrip;
- TDefaultContainer = class;
- TDefaultContainerArray = Array of TDefaultContainer;
- TPhotosEntitySet = class;
- TPhotosEntitySetArray = Array of TPhotosEntitySet;
- TPeopleEntitySet = class;
- TPeopleEntitySetArray = Array of TPeopleEntitySet;
- TAirlinesEntitySet = class;
- TAirlinesEntitySetArray = Array of TAirlinesEntitySet;
- TAirportsEntitySet = class;
- TAirportsEntitySetArray = Array of TAirportsEntitySet;
- TTripImplicitEntitySet = class;
- TTripImplicitEntitySetArray = Array of TTripImplicitEntitySet;
- TPlanItemImplicitEntitySet = class;
- TPlanItemImplicitEntitySetArray = Array of TPlanItemImplicitEntitySet;
- TService = class;
- TServiceArray = Array of TService;
- //
-
- // Enumerations
-
- {$SCOPEDENUMS ON}
- TPersonGender = (Male,Female,Unknown);
- TPersonGenderArray = Array of TPersonGender;
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: City
- --------------------------------------------------------------------}
-
- TCity = Class(TODataEntity)
- private
- FCountryRegion : string;
- FName : string;
- FRegion : string;
- procedure SetCountryRegion(AIndex: Integer; const AValue: string);
- procedure SetName(AIndex: Integer; const AValue: string);
- procedure SetRegion(AIndex: Integer; const AValue: string);
- public
- class function ObjectRestKind : String; Override;
- published
- Property CountryRegion : string index 0 read FCountryRegion write SetCountryRegion;
- Property Name : string index 8 read FName write SetName;
- Property Region : string index 16 read FRegion write SetRegion;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: Location
- --------------------------------------------------------------------}
-
- TLocation = Class(TODataEntity)
- private
- FAddress : string;
- FCity : TCity;
- procedure SetAddress(AIndex: Integer; const AValue: string);
- procedure SetCity(AIndex: Integer; const AValue: TCity);
- public
- class function ObjectRestKind : String; Override;
- published
- Property Address : string index 0 read FAddress write SetAddress;
- Property City : TCity index 8 read FCity write SetCity;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: EventLocation
- --------------------------------------------------------------------}
-
- TEventLocation = Class(TLocation)
- private
- FBuildingInfo : string;
- procedure SetBuildingInfo(AIndex: Integer; const AValue: string);
- public
- class function ObjectRestKind : String; Override;
- published
- Property BuildingInfo : string index 16 read FBuildingInfo write SetBuildingInfo;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: AirportLocation
- --------------------------------------------------------------------}
-
- TAirportLocation = Class(TLocation)
- private
- FLoc : TGeographyPoint;
- procedure SetLoc(AIndex: Integer; const AValue: TGeographyPoint);
- public
- class function ObjectRestKind : String; Override;
- published
- Property Loc : TGeographyPoint index 16 read FLoc write SetLoc;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: Photo
- --------------------------------------------------------------------}
-
- TPhoto = Class(TODataEntity)
- private
- FId : int64;
- FName : string;
- procedure SetId(AIndex: Integer; const AValue: int64);
- procedure SetName(AIndex: Integer; const AValue: string);
- public
- class function ObjectRestKind : String; Override;
- function KeyAsURLPart : String; Override;
- procedure GetStream(AService: TODataService; AContentType: String;
- AStream: TStream);
- procedure SetStream(AService: TODataService; AContentType: String;
- AStream: TStream);
- published
- Property Id : int64 index 0 read FId write SetId;
- Property Name : string index 8 read FName write SetName;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: Person
- --------------------------------------------------------------------}
-
- TPerson = Class(TODataEntity)
- private
- FUserName : string;
- FFirstName : string;
- FLastName : string;
- FEmails : TStringArray;
- FAddressInfo : TLocationArray;
- FGender : TPersonGender;
- FConcurrency : int64;
- procedure SetUserName(AIndex: Integer; const AValue: string);
- procedure SetFirstName(AIndex: Integer; const AValue: string);
- procedure SetLastName(AIndex: Integer; const AValue: string);
- procedure SetEmails(AIndex: Integer; const AValue: TStringArray);
- procedure SetAddressInfo(AIndex: Integer; const AValue: TLocationArray);
- procedure SetGender(AIndex: Integer; const AValue: TPersonGender);
- procedure SetConcurrency(AIndex: Integer; const AValue: int64);
- protected
- {$IFDEF VER2_6}
- procedure SetArrayLength(const AName: String; ALength: Longint)
- ; Override;
- {$ENDIF VER2_6}
- public
- function GetFavoriteAirline(AService: TODataService) : TAirline;
- function GetFriendsTrips(AService: TODataService; userName: string)
- : TTripArray;
- procedure ShareTrip(AService: TODataService; userName: string;
- tripId: TInt32);
- class function ObjectRestKind : String; Override;
- function KeyAsURLPart : String; Override;
- function Friends(AService: TODataService) : TPeopleEntitySet;
- function Trips(AService: TODataService) : TTripImplicitEntitySet;
- function Photo(AService: TODataService) : TPhoto;
- published
- Property UserName : string index 0 read FUserName write SetUserName;
- Property FirstName : string index 8 read FFirstName write SetFirstName;
- Property LastName : string index 16 read FLastName write SetLastName;
- Property Emails : TStringArray index 24 read FEmails write SetEmails;
- Property AddressInfo : TLocationArray index 32 read FAddressInfo write SetAddressInfo;
- Property Gender : TPersonGender index 40 read FGender write SetGender;
- Property Concurrency : int64 index 48 read FConcurrency write SetConcurrency;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: Airline
- --------------------------------------------------------------------}
-
- TAirline = Class(TODataEntity)
- private
- FAirlineCode : string;
- FName : string;
- procedure SetAirlineCode(AIndex: Integer; const AValue: string);
- procedure SetName(AIndex: Integer; const AValue: string);
- public
- class function ObjectRestKind : String; Override;
- function KeyAsURLPart : String; Override;
- published
- Property AirlineCode : string index 0 read FAirlineCode write SetAirlineCode;
- Property Name : string index 8 read FName write SetName;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: Airport
- --------------------------------------------------------------------}
-
- TAirport = Class(TODataEntity)
- private
- FIcaoCode : string;
- FName : string;
- FIataCode : string;
- FLocation : TAirportLocation;
- procedure SetIcaoCode(AIndex: Integer; const AValue: string);
- procedure SetName(AIndex: Integer; const AValue: string);
- procedure SetIataCode(AIndex: Integer; const AValue: string);
- procedure SetLocation(AIndex: Integer; const AValue: TAirportLocation);
- public
- class function ObjectRestKind : String; Override;
- function KeyAsURLPart : String; Override;
- published
- Property IcaoCode : string index 0 read FIcaoCode write SetIcaoCode;
- Property Name : string index 8 read FName write SetName;
- Property IataCode : string index 16 read FIataCode write SetIataCode;
- Property Location : TAirportLocation index 24 read FLocation write SetLocation;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: PlanItem
- --------------------------------------------------------------------}
-
- TPlanItem = Class(TODataEntity)
- private
- FPlanItemId : TInt32;
- FConfirmationCode : string;
- FStartsAt : TDateTime;
- FEndsAt : TDateTime;
- FDuration : TDuration;
- procedure SetPlanItemId(AIndex: Integer; const AValue: TInt32);
- procedure SetConfirmationCode(AIndex: Integer; const AValue: string);
- procedure SetStartsAt(AIndex: Integer; const AValue: TDateTime);
- procedure SetEndsAt(AIndex: Integer; const AValue: TDateTime);
- procedure SetDuration(AIndex: Integer; const AValue: TDuration);
- public
- class function ObjectRestKind : String; Override;
- function KeyAsURLPart : String; Override;
- published
- Property PlanItemId : TInt32 index 0 read FPlanItemId write SetPlanItemId;
- Property ConfirmationCode : string index 8 read FConfirmationCode write SetConfirmationCode;
- Property StartsAt : TDateTime index 16 read FStartsAt write SetStartsAt;
- Property EndsAt : TDateTime index 24 read FEndsAt write SetEndsAt;
- Property Duration : TDuration index 32 read FDuration write SetDuration;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: PublicTransportation
- --------------------------------------------------------------------}
-
- TPublicTransportation = Class(TPlanItem)
- private
- FSeatNumber : string;
- procedure SetSeatNumber(AIndex: Integer; const AValue: string);
- public
- class function ObjectRestKind : String; Override;
- published
- Property SeatNumber : string index 40 read FSeatNumber write SetSeatNumber;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: Flight
- --------------------------------------------------------------------}
-
- TFlight = Class(TPublicTransportation)
- private
- FFlightNumber : string;
- procedure SetFlightNumber(AIndex: Integer; const AValue: string);
- public
- class function ObjectRestKind : String; Override;
- function From(AService: TODataService) : TAirport;
- function _To(AService: TODataService) : TAirport;
- function Airline(AService: TODataService) : TAirline;
- published
- Property FlightNumber : string index 48 read FFlightNumber write SetFlightNumber;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: Event
- --------------------------------------------------------------------}
-
- TEvent = Class(TPlanItem)
- private
- FDescription : string;
- FOccursAt : TEventLocation;
- procedure SetDescription(AIndex: Integer; const AValue: string);
- procedure SetOccursAt(AIndex: Integer; const AValue: TEventLocation);
- public
- class function ObjectRestKind : String; Override;
- published
- Property Description : string index 40 read FDescription write SetDescription;
- Property OccursAt : TEventLocation index 48 read FOccursAt write SetOccursAt;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: Trip
- --------------------------------------------------------------------}
-
- TTrip = Class(TODataEntity)
- private
- FTripId : TInt32;
- FShareId : TGUIDString;
- FDescription : string;
- FName : string;
- FBudget : Single;
- FStartsAt : TDateTime;
- FEndsAt : TDateTime;
- FTags : TStringArray;
- procedure SetTripId(AIndex: Integer; const AValue: TInt32);
- procedure SetShareId(AIndex: Integer; const AValue: TGUIDString);
- procedure SetDescription(AIndex: Integer; const AValue: string);
- procedure SetName(AIndex: Integer; const AValue: string);
- procedure SetBudget(AIndex: Integer; const AValue: Single);
- procedure SetStartsAt(AIndex: Integer; const AValue: TDateTime);
- procedure SetEndsAt(AIndex: Integer; const AValue: TDateTime);
- procedure SetTags(AIndex: Integer; const AValue: TStringArray);
- protected
- {$IFDEF VER2_6}
- procedure SetArrayLength(const AName: String; ALength: Longint)
- ; Override;
- {$ENDIF VER2_6}
- public
- function GetInvolvedPeople(AService: TODataService) : TPersonArray;
- class function ObjectRestKind : String; Override;
- function KeyAsURLPart : String; Override;
- function Photos(AService: TODataService) : TPhotosEntitySet;
- function PlanItems(AService: TODataService) : TPlanItemImplicitEntitySet;
- published
- Property TripId : TInt32 index 0 read FTripId write SetTripId;
- Property ShareId : TGUIDString index 8 read FShareId write SetShareId;
- Property Description : string index 16 read FDescription write SetDescription;
- Property Name : string index 24 read FName write SetName;
- Property Budget : Single index 32 read FBudget write SetBudget;
- Property StartsAt : TDateTime index 40 read FStartsAt write SetStartsAt;
- Property EndsAt : TDateTime index 48 read FEndsAt write SetEndsAt;
- Property Tags : TStringArray index 56 read FTags write SetTags;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: DefaultContainer
- --------------------------------------------------------------------}
-
- TDefaultContainer = Class(TODataEntityContainer)
- private
- FPhotos : TPhotosEntitySet;
- FPeople : TPeopleEntitySet;
- FAirlines : TAirlinesEntitySet;
- FAirports : TAirportsEntitySet;
- FMe : TPerson;
- function GetPhotos : TPhotosEntitySet;
- function GetPeople : TPeopleEntitySet;
- function GetAirlines : TAirlinesEntitySet;
- function GetAirports : TAirportsEntitySet;
- function GetMe : TPerson;
- public
- class function ObjectRestKind : String; Override;
- function CreateNewPhotos : TPhotosEntitySet;
- function CreateNewPeople : TPeopleEntitySet;
- function CreateNewAirlines : TAirlinesEntitySet;
- function CreateNewAirports : TAirportsEntitySet;
- function FetchMe : TPerson;
- procedure ResetDataSource;
- function GetNearestAirport(lat: Double; lon: Double) : TAirport;
- published
- Property Photos : TPhotosEntitySet read GetPhotos;
- Property People : TPeopleEntitySet read GetPeople;
- Property Airlines : TAirlinesEntitySet read GetAirlines;
- Property Airports : TAirportsEntitySet read GetAirports;
- Property Me : TPerson read GetMe;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: Photos
- --------------------------------------------------------------------}
-
- TPhotosEntitySet = Class(TODataEntitySet)
- public
- class function ObjectRestKind : String; Override;
- class function EntityClass : TODataEntityClass; Override;
- function Get(const Id: int64) : TPhoto;
- function List(const AQuery: String; out NextLink: String) : TPhotoArray;
- function List(const AQuery: TQueryParams; out NextLink: String)
- : TPhotoArray;
- function ListAll(const AQuery: String) : TPhotoArray;
- function ListAll(const AQuery: TQueryParams) : TPhotoArray;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: People
- --------------------------------------------------------------------}
-
- TPeopleEntitySet = Class(TODataEntitySet)
- public
- class function ObjectRestKind : String; Override;
- class function EntityClass : TODataEntityClass; Override;
- function Get(const UserName: string) : TPerson;
- function List(const AQuery: String; out NextLink: String) : TPersonArray;
- function List(const AQuery: TQueryParams; out NextLink: String)
- : TPersonArray;
- function ListAll(const AQuery: String) : TPersonArray;
- function ListAll(const AQuery: TQueryParams) : TPersonArray;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: Airlines
- --------------------------------------------------------------------}
-
- TAirlinesEntitySet = Class(TODataEntitySet)
- public
- class function ObjectRestKind : String; Override;
- class function EntityClass : TODataEntityClass; Override;
- function Get(const AirlineCode: string) : TAirline;
- function List(const AQuery: String; out NextLink: String)
- : TAirlineArray;
- function List(const AQuery: TQueryParams; out NextLink: String)
- : TAirlineArray;
- function ListAll(const AQuery: String) : TAirlineArray;
- function ListAll(const AQuery: TQueryParams) : TAirlineArray;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: Airports
- --------------------------------------------------------------------}
-
- TAirportsEntitySet = Class(TODataEntitySet)
- public
- class function ObjectRestKind : String; Override;
- class function EntityClass : TODataEntityClass; Override;
- function Get(const IcaoCode: string) : TAirport;
- function List(const AQuery: String; out NextLink: String)
- : TAirportArray;
- function List(const AQuery: TQueryParams; out NextLink: String)
- : TAirportArray;
- function ListAll(const AQuery: String) : TAirportArray;
- function ListAll(const AQuery: TQueryParams) : TAirportArray;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: TripImplicitEntitySet
- --------------------------------------------------------------------}
-
- TTripImplicitEntitySet = Class(TODataEntitySet)
- public
- class function ObjectRestKind : String; Override;
- class function EntityClass : TODataEntityClass; Override;
- function Get(const TripId: TInt32) : TTrip;
- function List(const AQuery: String; out NextLink: String) : TTripArray;
- function List(const AQuery: TQueryParams; out NextLink: String)
- : TTripArray;
- function ListAll(const AQuery: String) : TTripArray;
- function ListAll(const AQuery: TQueryParams) : TTripArray;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: PlanItemImplicitEntitySet
- --------------------------------------------------------------------}
-
- TPlanItemImplicitEntitySet = Class(TODataEntitySet)
- public
- class function ObjectRestKind : String; Override;
- class function EntityClass : TODataEntityClass; Override;
- function Get(const PlanItemId: TInt32) : TPlanItem;
- function List(const AQuery: String; out NextLink: String)
- : TPlanItemArray;
- function List(const AQuery: TQueryParams; out NextLink: String)
- : TPlanItemArray;
- function ListAll(const AQuery: String) : TPlanItemArray;
- function ListAll(const AQuery: TQueryParams) : TPlanItemArray;
- end;
-
-
- { --------------------------------------------------------------------
- Microsoft.OData.SampleService.Models.TripPin: Microsoft.OData.SampleService.Models.TripPin
- --------------------------------------------------------------------}
-
- TService = Class(TODataService)
- private
- FDefaultContainer : TDefaultContainer;
- function GetDefaultContainer : TDefaultContainer;
- public
- class function ObjectRestKind : String; Override;
- function CreateNewDefaultContainer : TDefaultContainer;
- published
- Property DefaultContainer : TDefaultContainer read GetDefaultContainer;
- end;
-
- implementation
- { --------------------------------------------------------------------
- TCity
- --------------------------------------------------------------------}
- Class Function TCity.ObjectRestKind : String;
- begin
- Result:='City';
- end;
- Procedure TCity.SetCountryRegion(AIndex: Integer; const AValue: string);
- begin
- If (FCountryRegion=AValue) then exit;
- FCountryRegion:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TCity.SetName(AIndex: Integer; const AValue: string);
- begin
- If (FName=AValue) then exit;
- FName:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TCity.SetRegion(AIndex: Integer; const AValue: string);
- begin
- If (FRegion=AValue) then exit;
- FRegion:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- { --------------------------------------------------------------------
- TLocation
- --------------------------------------------------------------------}
- Class Function TLocation.ObjectRestKind : String;
- begin
- Result:='Location';
- end;
- Procedure TLocation.SetAddress(AIndex: Integer; const AValue: string);
- begin
- If (FAddress=AValue) then exit;
- FAddress:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TLocation.SetCity(AIndex: Integer; const AValue: TCity);
- begin
- If (FCity=AValue) then exit;
- FCity:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- { --------------------------------------------------------------------
- TEventLocation
- --------------------------------------------------------------------}
- Class Function TEventLocation.ObjectRestKind : String;
- begin
- Result:='EventLocation';
- end;
- Procedure TEventLocation.SetBuildingInfo(AIndex: Integer; const AValue: string);
- begin
- If (FBuildingInfo=AValue) then exit;
- FBuildingInfo:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- { --------------------------------------------------------------------
- TAirportLocation
- --------------------------------------------------------------------}
- Class Function TAirportLocation.ObjectRestKind : String;
- begin
- Result:='AirportLocation';
- end;
- Procedure TAirportLocation.SetLoc(AIndex: Integer; const AValue: TGeographyPoint);
- begin
- If (FLoc=AValue) then exit;
- FLoc:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- { --------------------------------------------------------------------
- TPhoto
- --------------------------------------------------------------------}
- Class Function TPhoto.ObjectRestKind : String;
- begin
- Result:='Photo';
- end;
- Procedure TPhoto.SetId(AIndex: Integer; const AValue: int64);
- begin
- If (FId=AValue) then exit;
- FId:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TPhoto.SetName(AIndex: Integer; const AValue: string);
- begin
- If (FName=AValue) then exit;
- FName:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Function TPhoto.KeyAsURLPart : string;
- begin
- Result:=IntToStr(Id);
- end;
- Procedure TPhoto.GetStream(AService: TODataService; AContentType: String; AStream: TStream);
- begin
- DoGetStream(AService,AContentType,AStream);
- end;
- Procedure TPhoto.SetStream(AService: TODataService; AContentType: String; AStream: TStream);
- begin
- DoSetStream(AService,AContentType,AStream);
- end;
- { --------------------------------------------------------------------
- TPerson
- --------------------------------------------------------------------}
- Function TPerson.GetFavoriteAirline(AService: TODataService) : TAirline;
- Var
- _Res : String;
- _Path : String;
- begin
- _Path:='('+_Path+')';
- _Path:='Microsoft.OData.SampleService.Models.TripPin.GetFavoriteAirline'+_Path;
- _Path:=BaseURL(AService)+'/'+_Path;
- Result:=TAirline(AService.SingleServiceCall(_Path,'',TAirline));
- end;
- Function TPerson.GetFriendsTrips(AService: TODataService; userName: string) : TTripArray;
- Var
- _Res : String;
- _Path : String;
- begin
- _Path:='userName='+TODataObject.MakeKeyString(userName);
- _Path:='('+_Path+')';
- _Path:='Microsoft.OData.SampleService.Models.TripPin.GetFriendsTrips'+_Path;
- _Path:=BaseURL(AService)+'/'+_Path;
- Result:=TTripArray(AService.GetMulti(_Path,'',TTrip,True,_Res));
- end;
- Procedure TPerson.ShareTrip(AService: TODataService; userName: string; tripId: TInt32);
- Var
- _JSON : TJSONObject;
- _data : String;
- _Path : String;
- begin
- _JSON:=TJSONObject.Create;
- try
- _JSON.Add('userName',userName);
- _JSON.Add('tripId',tripId);
- _data:=_JSON.AsJSON;
- finally
- FreeAndNil(_JSON);
- end;
- _Path:=BaseURL(AService)+'/Microsoft.OData.SampleService.Models.TripPin.ShareTrip';
- AService.ServiceCall('POST',_Path,'',_Data);
- end;
- Class Function TPerson.ObjectRestKind : String;
- begin
- Result:='Person';
- end;
- Procedure TPerson.SetUserName(AIndex: Integer; const AValue: string);
- begin
- If (FUserName=AValue) then exit;
- FUserName:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TPerson.SetFirstName(AIndex: Integer; const AValue: string);
- begin
- If (FFirstName=AValue) then exit;
- FFirstName:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TPerson.SetLastName(AIndex: Integer; const AValue: string);
- begin
- If (FLastName=AValue) then exit;
- FLastName:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TPerson.SetEmails(AIndex: Integer; const AValue: TStringArray);
- begin
- If (FEmails=AValue) then exit;
- FEmails:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TPerson.SetAddressInfo(AIndex: Integer; const AValue: TLocationArray);
- begin
- If (FAddressInfo=AValue) then exit;
- FAddressInfo:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TPerson.SetGender(AIndex: Integer; const AValue: TPersonGender);
- begin
- If (FGender=AValue) then exit;
- FGender:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TPerson.SetConcurrency(AIndex: Integer; const AValue: int64);
- begin
- If (FConcurrency=AValue) then exit;
- FConcurrency:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- {$IFDEF VER2_6}
- Procedure TPerson.SetArrayLength(const AName: String; ALength: Longint);
- begin
- Case aName of
- 'emails' : SetLength(FEmails,aLength);
- 'addressinfo' : SetLength(FAddressInfo,aLength);
- else
- inherited SetArrayLength(aName,ALength);
- end;
- end;
- {$ENDIF VER2_6}
- Function TPerson.KeyAsURLPart : string;
- begin
- Result:=TODataObject.MakeKeyString(UserName);
- end;
- Function TPerson.Friends(AService: TODataService) : TPeopleEntitySet;
- begin
- Result:=TPeopleEntitySet(CreateContainedEntitySet(AService,'Friends', TPeopleEntitySet));
- end;
- Function TPerson.Trips(AService: TODataService) : TTripImplicitEntitySet;
- begin
- Result:=TTripImplicitEntitySet(CreateContainedEntitySet(AService,'Trips', TTripImplicitEntitySet));
- end;
- Function TPerson.Photo(AService: TODataService) : TPhoto;
- begin
- Result:=TPhoto(GetContainedSingleTon(AService,'Photo', TPhoto));
- end;
- { --------------------------------------------------------------------
- TAirline
- --------------------------------------------------------------------}
- Class Function TAirline.ObjectRestKind : String;
- begin
- Result:='Airline';
- end;
- Procedure TAirline.SetAirlineCode(AIndex: Integer; const AValue: string);
- begin
- If (FAirlineCode=AValue) then exit;
- FAirlineCode:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TAirline.SetName(AIndex: Integer; const AValue: string);
- begin
- If (FName=AValue) then exit;
- FName:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Function TAirline.KeyAsURLPart : string;
- begin
- Result:=TODataObject.MakeKeyString(AirlineCode);
- end;
- { --------------------------------------------------------------------
- TAirport
- --------------------------------------------------------------------}
- Class Function TAirport.ObjectRestKind : String;
- begin
- Result:='Airport';
- end;
- Procedure TAirport.SetIcaoCode(AIndex: Integer; const AValue: string);
- begin
- If (FIcaoCode=AValue) then exit;
- FIcaoCode:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TAirport.SetName(AIndex: Integer; const AValue: string);
- begin
- If (FName=AValue) then exit;
- FName:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TAirport.SetIataCode(AIndex: Integer; const AValue: string);
- begin
- If (FIataCode=AValue) then exit;
- FIataCode:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TAirport.SetLocation(AIndex: Integer; const AValue: TAirportLocation);
- begin
- If (FLocation=AValue) then exit;
- FLocation:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Function TAirport.KeyAsURLPart : string;
- begin
- Result:=TODataObject.MakeKeyString(IcaoCode);
- end;
- { --------------------------------------------------------------------
- TPlanItem
- --------------------------------------------------------------------}
- Class Function TPlanItem.ObjectRestKind : String;
- begin
- Result:='PlanItem';
- end;
- Procedure TPlanItem.SetPlanItemId(AIndex: Integer; const AValue: TInt32);
- begin
- If (FPlanItemId=AValue) then exit;
- FPlanItemId:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TPlanItem.SetConfirmationCode(AIndex: Integer; const AValue: string);
- begin
- If (FConfirmationCode=AValue) then exit;
- FConfirmationCode:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TPlanItem.SetStartsAt(AIndex: Integer; const AValue: TDateTime);
- begin
- If (FStartsAt=AValue) then exit;
- FStartsAt:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TPlanItem.SetEndsAt(AIndex: Integer; const AValue: TDateTime);
- begin
- If (FEndsAt=AValue) then exit;
- FEndsAt:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TPlanItem.SetDuration(AIndex: Integer; const AValue: TDuration);
- begin
- If (FDuration=AValue) then exit;
- FDuration:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Function TPlanItem.KeyAsURLPart : string;
- begin
- Result:=IntToStr(PlanItemId);
- end;
- { --------------------------------------------------------------------
- TPublicTransportation
- --------------------------------------------------------------------}
- Class Function TPublicTransportation.ObjectRestKind : String;
- begin
- Result:='PublicTransportation';
- end;
- Procedure TPublicTransportation.SetSeatNumber(AIndex: Integer; const AValue: string);
- begin
- If (FSeatNumber=AValue) then exit;
- FSeatNumber:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- { --------------------------------------------------------------------
- TFlight
- --------------------------------------------------------------------}
- Class Function TFlight.ObjectRestKind : String;
- begin
- Result:='Flight';
- end;
- Procedure TFlight.SetFlightNumber(AIndex: Integer; const AValue: string);
- begin
- If (FFlightNumber=AValue) then exit;
- FFlightNumber:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Function TFlight.From(AService: TODataService) : TAirport;
- begin
- Result:=TAirport(GetContainedSingleTon(AService,'From', TAirport));
- end;
- Function TFlight._To(AService: TODataService) : TAirport;
- begin
- Result:=TAirport(GetContainedSingleTon(AService,'To', TAirport));
- end;
- Function TFlight.Airline(AService: TODataService) : TAirline;
- begin
- Result:=TAirline(GetContainedSingleTon(AService,'Airline', TAirline));
- end;
- { --------------------------------------------------------------------
- TEvent
- --------------------------------------------------------------------}
- Class Function TEvent.ObjectRestKind : String;
- begin
- Result:='Event';
- end;
- Procedure TEvent.SetDescription(AIndex: Integer; const AValue: string);
- begin
- If (FDescription=AValue) then exit;
- FDescription:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TEvent.SetOccursAt(AIndex: Integer; const AValue: TEventLocation);
- begin
- If (FOccursAt=AValue) then exit;
- FOccursAt:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- { --------------------------------------------------------------------
- TTrip
- --------------------------------------------------------------------}
- Function TTrip.GetInvolvedPeople(AService: TODataService) : TPersonArray;
- Var
- _Res : String;
- _Path : String;
- begin
- _Path:='('+_Path+')';
- _Path:='Microsoft.OData.SampleService.Models.TripPin.GetInvolvedPeople'+_Path;
- _Path:=BaseURL(AService)+'/'+_Path;
- Result:=TPersonArray(AService.GetMulti(_Path,'',TPerson,True,_Res));
- end;
- Class Function TTrip.ObjectRestKind : String;
- begin
- Result:='Trip';
- end;
- Procedure TTrip.SetTripId(AIndex: Integer; const AValue: TInt32);
- begin
- If (FTripId=AValue) then exit;
- FTripId:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TTrip.SetShareId(AIndex: Integer; const AValue: TGUIDString);
- begin
- If (FShareId=AValue) then exit;
- FShareId:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TTrip.SetDescription(AIndex: Integer; const AValue: string);
- begin
- If (FDescription=AValue) then exit;
- FDescription:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TTrip.SetName(AIndex: Integer; const AValue: string);
- begin
- If (FName=AValue) then exit;
- FName:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TTrip.SetBudget(AIndex: Integer; const AValue: Single);
- begin
- If (FBudget=AValue) then exit;
- FBudget:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TTrip.SetStartsAt(AIndex: Integer; const AValue: TDateTime);
- begin
- If (FStartsAt=AValue) then exit;
- FStartsAt:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TTrip.SetEndsAt(AIndex: Integer; const AValue: TDateTime);
- begin
- If (FEndsAt=AValue) then exit;
- FEndsAt:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- Procedure TTrip.SetTags(AIndex: Integer; const AValue: TStringArray);
- begin
- If (FTags=AValue) then exit;
- FTags:=AValue;
- MarkPropertyChanged(AIndex);
- end;
- {$IFDEF VER2_6}
- Procedure TTrip.SetArrayLength(const AName: String; ALength: Longint);
- begin
- Case aName of
- 'tags' : SetLength(FTags,aLength);
- else
- inherited SetArrayLength(aName,ALength);
- end;
- end;
- {$ENDIF VER2_6}
- Function TTrip.KeyAsURLPart : string;
- begin
- Result:=IntToStr(TripId);
- end;
- Function TTrip.Photos(AService: TODataService) : TPhotosEntitySet;
- begin
- Result:=TPhotosEntitySet(CreateContainedEntitySet(AService,'Photos', TPhotosEntitySet));
- end;
- Function TTrip.PlanItems(AService: TODataService) : TPlanItemImplicitEntitySet;
- begin
- Result:=TPlanItemImplicitEntitySet(CreateContainedEntitySet(AService,'PlanItems', TPlanItemImplicitEntitySet));
- end;
- { --------------------------------------------------------------------
- TDefaultContainer
- --------------------------------------------------------------------}
- Class Function TDefaultContainer.ObjectRestKind : String;
- begin
- Result:='DefaultContainer';
- end;
- Function TDefaultContainer.CreateNewPhotos : TPhotosEntitySet;
- begin
- Result:=TPhotosEntitySet(CreateEntitySet(TPhotosEntitySet));
- end;
- Function TDefaultContainer.GetPhotos : TPhotosEntitySet;
- begin
- If Not Assigned(FPhotos) then
- FPhotos:=TPhotosEntitySet(CreateEntitySet(TPhotosEntitySet));
- Result:=FPhotos;
- end;
- Function TDefaultContainer.CreateNewPeople : TPeopleEntitySet;
- begin
- Result:=TPeopleEntitySet(CreateEntitySet(TPeopleEntitySet));
- end;
- Function TDefaultContainer.GetPeople : TPeopleEntitySet;
- begin
- If Not Assigned(FPeople) then
- FPeople:=TPeopleEntitySet(CreateEntitySet(TPeopleEntitySet));
- Result:=FPeople;
- end;
- Function TDefaultContainer.CreateNewAirlines : TAirlinesEntitySet;
- begin
- Result:=TAirlinesEntitySet(CreateEntitySet(TAirlinesEntitySet));
- end;
- Function TDefaultContainer.GetAirlines : TAirlinesEntitySet;
- begin
- If Not Assigned(FAirlines) then
- FAirlines:=TAirlinesEntitySet(CreateEntitySet(TAirlinesEntitySet));
- Result:=FAirlines;
- end;
- Function TDefaultContainer.CreateNewAirports : TAirportsEntitySet;
- begin
- Result:=TAirportsEntitySet(CreateEntitySet(TAirportsEntitySet));
- end;
- Function TDefaultContainer.GetAirports : TAirportsEntitySet;
- begin
- If Not Assigned(FAirports) then
- FAirports:=TAirportsEntitySet(CreateEntitySet(TAirportsEntitySet));
- Result:=FAirports;
- end;
- Function TDefaultContainer.FetchMe : TPerson;
- begin
- CheckService;
- Result:=TPerson(Service.SingleServiceCall('Me','',TPerson));
- Result.BasePath:='Me';
- end;
- Function TDefaultContainer.GetMe : TPerson;
- begin
- If Not Assigned(FMe) then
- FMe:=FetchMe;
- Result:=FMe;
- end;
- Procedure TDefaultContainer.ResetDataSource;
- Var
- _data : String;
- _Path : String;
- begin
- CheckService;
- _data:='';
- _Path:='/ResetDataSource';
- Service.ServiceCall('POST',_Path,'',_Data);
- end;
- Function TDefaultContainer.GetNearestAirport(lat: Double; lon: Double) : TAirport;
- Var
- _Res : String;
- _Path : String;
- begin
- CheckService;
- _Path:='lat='+FloatToStr(lat);
- _Path:=_Path+','+'lon='+FloatToStr(lon);
- _Path:='('+_Path+')';
- _Path:='GetNearestAirport'+_Path;
- Result:=TAirport(Service.SingleServiceCall(_Path,'',TAirport));
- end;
- { --------------------------------------------------------------------
- TPhotosEntitySet
- --------------------------------------------------------------------}
- Class Function TPhotosEntitySet.ObjectRestKind : String;
- begin
- Result:='Photos';
- end;
- Class Function TPhotosEntitySet.EntityClass : TODataEntityClass;
- begin
- Result:=TPhoto;
- end;
- Function TPhotosEntitySet.Get(const Id: int64) : TPhoto;
- begin
- Result:=TPhoto(GetSingle(IntToStr(Id)));
- end;
- Function TPhotosEntitySet.List(const AQuery: String; out NextLink: String) : TPhotoArray;
- begin
- Result:=TPhotoArray(GetMulti(AQuery,False,NextLink));
- end;
- Function TPhotosEntitySet.List(const AQuery: TQueryParams; out NextLink: String) : TPhotoArray;
- begin
- Result:=TPhotoArray(GetMulti(AQuery,False,NextLink));
- end;
- Function TPhotosEntitySet.ListAll(const AQuery: String) : TPhotoArray;
- var N : String;
- begin
- Result:=TPhotoArray(GetMulti(AQuery,True,N));
- end;
- Function TPhotosEntitySet.ListAll(const AQuery: TQueryParams) : TPhotoArray;
- var N : String;
- begin
- Result:=TPhotoArray(GetMulti(AQuery,True,N));
- end;
- { --------------------------------------------------------------------
- TPeopleEntitySet
- --------------------------------------------------------------------}
- Class Function TPeopleEntitySet.ObjectRestKind : String;
- begin
- Result:='People';
- end;
- Class Function TPeopleEntitySet.EntityClass : TODataEntityClass;
- begin
- Result:=TPerson;
- end;
- Function TPeopleEntitySet.Get(const UserName: string) : TPerson;
- begin
- Result:=TPerson(GetSingle(TODataObject.MakeKeyString(UserName)));
- end;
- Function TPeopleEntitySet.List(const AQuery: String; out NextLink: String) : TPersonArray;
- begin
- Result:=TPersonArray(GetMulti(AQuery,False,NextLink));
- end;
- Function TPeopleEntitySet.List(const AQuery: TQueryParams; out NextLink: String) : TPersonArray;
- begin
- Result:=TPersonArray(GetMulti(AQuery,False,NextLink));
- end;
- Function TPeopleEntitySet.ListAll(const AQuery: String) : TPersonArray;
- var N : String;
- begin
- Result:=TPersonArray(GetMulti(AQuery,True,N));
- end;
- Function TPeopleEntitySet.ListAll(const AQuery: TQueryParams) : TPersonArray;
- var N : String;
- begin
- Result:=TPersonArray(GetMulti(AQuery,True,N));
- end;
- { --------------------------------------------------------------------
- TAirlinesEntitySet
- --------------------------------------------------------------------}
- Class Function TAirlinesEntitySet.ObjectRestKind : String;
- begin
- Result:='Airlines';
- end;
- Class Function TAirlinesEntitySet.EntityClass : TODataEntityClass;
- begin
- Result:=TAirline;
- end;
- Function TAirlinesEntitySet.Get(const AirlineCode: string) : TAirline;
- begin
- Result:=TAirline(GetSingle(TODataObject.MakeKeyString(AirlineCode)));
- end;
- Function TAirlinesEntitySet.List(const AQuery: String; out NextLink: String) : TAirlineArray;
- begin
- Result:=TAirlineArray(GetMulti(AQuery,False,NextLink));
- end;
- Function TAirlinesEntitySet.List(const AQuery: TQueryParams; out NextLink: String) : TAirlineArray;
- begin
- Result:=TAirlineArray(GetMulti(AQuery,False,NextLink));
- end;
- Function TAirlinesEntitySet.ListAll(const AQuery: String) : TAirlineArray;
- var N : String;
- begin
- Result:=TAirlineArray(GetMulti(AQuery,True,N));
- end;
- Function TAirlinesEntitySet.ListAll(const AQuery: TQueryParams) : TAirlineArray;
- var N : String;
- begin
- Result:=TAirlineArray(GetMulti(AQuery,True,N));
- end;
- { --------------------------------------------------------------------
- TAirportsEntitySet
- --------------------------------------------------------------------}
- Class Function TAirportsEntitySet.ObjectRestKind : String;
- begin
- Result:='Airports';
- end;
- Class Function TAirportsEntitySet.EntityClass : TODataEntityClass;
- begin
- Result:=TAirport;
- end;
- Function TAirportsEntitySet.Get(const IcaoCode: string) : TAirport;
- begin
- Result:=TAirport(GetSingle(TODataObject.MakeKeyString(IcaoCode)));
- end;
- Function TAirportsEntitySet.List(const AQuery: String; out NextLink: String) : TAirportArray;
- begin
- Result:=TAirportArray(GetMulti(AQuery,False,NextLink));
- end;
- Function TAirportsEntitySet.List(const AQuery: TQueryParams; out NextLink: String) : TAirportArray;
- begin
- Result:=TAirportArray(GetMulti(AQuery,False,NextLink));
- end;
- Function TAirportsEntitySet.ListAll(const AQuery: String) : TAirportArray;
- var N : String;
- begin
- Result:=TAirportArray(GetMulti(AQuery,True,N));
- end;
- Function TAirportsEntitySet.ListAll(const AQuery: TQueryParams) : TAirportArray;
- var N : String;
- begin
- Result:=TAirportArray(GetMulti(AQuery,True,N));
- end;
- { --------------------------------------------------------------------
- TTripImplicitEntitySet
- --------------------------------------------------------------------}
- Class Function TTripImplicitEntitySet.ObjectRestKind : String;
- begin
- Result:='TripImplicitEntitySet';
- end;
- Class Function TTripImplicitEntitySet.EntityClass : TODataEntityClass;
- begin
- Result:=TTrip;
- end;
- Function TTripImplicitEntitySet.Get(const TripId: TInt32) : TTrip;
- begin
- Result:=TTrip(GetSingle(IntToStr(TripId)));
- end;
- Function TTripImplicitEntitySet.List(const AQuery: String; out NextLink: String) : TTripArray;
- begin
- Result:=TTripArray(GetMulti(AQuery,False,NextLink));
- end;
- Function TTripImplicitEntitySet.List(const AQuery: TQueryParams; out NextLink: String) : TTripArray;
- begin
- Result:=TTripArray(GetMulti(AQuery,False,NextLink));
- end;
- Function TTripImplicitEntitySet.ListAll(const AQuery: String) : TTripArray;
- var N : String;
- begin
- Result:=TTripArray(GetMulti(AQuery,True,N));
- end;
- Function TTripImplicitEntitySet.ListAll(const AQuery: TQueryParams) : TTripArray;
- var N : String;
- begin
- Result:=TTripArray(GetMulti(AQuery,True,N));
- end;
- { --------------------------------------------------------------------
- TPlanItemImplicitEntitySet
- --------------------------------------------------------------------}
- Class Function TPlanItemImplicitEntitySet.ObjectRestKind : String;
- begin
- Result:='PlanItemImplicitEntitySet';
- end;
- Class Function TPlanItemImplicitEntitySet.EntityClass : TODataEntityClass;
- begin
- Result:=TPlanItem;
- end;
- Function TPlanItemImplicitEntitySet.Get(const PlanItemId: TInt32) : TPlanItem;
- begin
- Result:=TPlanItem(GetSingle(IntToStr(PlanItemId)));
- end;
- Function TPlanItemImplicitEntitySet.List(const AQuery: String; out NextLink: String) : TPlanItemArray;
- begin
- Result:=TPlanItemArray(GetMulti(AQuery,False,NextLink));
- end;
- Function TPlanItemImplicitEntitySet.List(const AQuery: TQueryParams; out NextLink: String) : TPlanItemArray;
- begin
- Result:=TPlanItemArray(GetMulti(AQuery,False,NextLink));
- end;
- Function TPlanItemImplicitEntitySet.ListAll(const AQuery: String) : TPlanItemArray;
- var N : String;
- begin
- Result:=TPlanItemArray(GetMulti(AQuery,True,N));
- end;
- Function TPlanItemImplicitEntitySet.ListAll(const AQuery: TQueryParams) : TPlanItemArray;
- var N : String;
- begin
- Result:=TPlanItemArray(GetMulti(AQuery,True,N));
- end;
- { --------------------------------------------------------------------
- TService
- --------------------------------------------------------------------}
- Class Function TService.ObjectRestKind : String;
- begin
- Result:='Microsoft.OData.SampleService.Models.TripPin';
- end;
- Function TService.CreateNewDefaultContainer : TDefaultContainer;
- begin
- Result:=TDefaultContainer(CreateEntityContainer(TDefaultContainer));
- end;
- Function TService.GetDefaultContainer : TDefaultContainer;
- begin
- If Not Assigned(FDefaultContainer) then
- FDefaultContainer:=TDefaultContainer(CreateEntityContainer(TDefaultContainer));
- Result:=FDefaultContainer;
- end;
- end.
|