I-Domain Modeling kwi-SAP CAP

intshayelelo

I-Domain Model kwi-SAP CAP ngumzekelo ochaza i-static, imiba enxulumene nedatha ye-domain yengxaki ngokwemifuziselo yobudlelwane bequmrhu. Kule nqaku siza kufunda i-Domain Modeling kwi-SAP CAP ngokubanzi.

iDomain Modeling

Ngamazwi alula, i-CDS kwi-SAP CAP ivelisa imodeli yesizinda ngendlela echaza ngayo ingxaki yeshishini ngokwezitshixo, amasimi kunye nezichasiselo. Ikhowudi yokuvelisa imodeli yesizinda ibhalwe kwi-CDS schema (db/schema.cds). Le mifuziselo yesizinda ingasetyenziswa kwiiNkcazo zeNkonzo, iiModeli zokuZingisa, iiDathabase okanye ziphinde zisetyenziswe kwakhona kwenye imodeli yesizinda.

Umzekelo weSampuli:

Isithuba segama empInfo; usebenzisa {Imali, elawulwa} ukusuka ku-'@sap/cds/common'; iqumrhu Abasebenzi: ilawulwa {isitshixo ID: Integer; firstName: Umtya wendawo (111); Igama lokugqibela: Umtya wendawo (1111); umphathi: Umbutho kubaphathi; umhla wokuManywa: Inani elipheleleyo; umvuzo: Idesimali (9,2); imali: Imali; }

 

Kulo mzekelo senze ifayile schema.cds apho senze iqumrhu Abasebenzi ababandakanya iinkcukacha ezisisiseko zoMqeshwa.

Esi sikimu siphela sinikwe isithuba samagama okt empInfo

Olu dweliso lwenkqubo lusebenzisa uhlobo lwedatha olusemgangathweni okt Currency. Ukusebenzisa uhlobo oluqhelekileyo lwedatha olufana nolu kusinceda ukuzisa lonke ixabiso elichazwe kwangaphambili linceda elinxulumene nalo.

Sisebenzisa iCDS ukwenza iModeli. Kuloo CDS, sisebenzisa

  1. Amaqumrhu amele isethi yezinto ezizodwa umz.:
    1. Ulwazi olusisiseko lwabasebenzi
    2. Ulwazi loNxibelelwano lwabaSebenzi
    3. Ulwazi loMvuzo waBasebenzi
  2. Imibutho yokuchaza ubudlelwane
    1. Unxulumano lomphathi kwelinye uMphathi weziko eliya kuba nalo lonke uluhlu lwaBaphathi

INgqungquthela yokunikwa kwamagama kunye neeNgcebiso

  1. Igama lequmrhu kufuneka liqale ngonobumba omkhulu kwaye kufuneka lifundeke ngumntu kwaye lizichaze ngokwalo - umzekelo, Abasebenzi.
  2. Qala izinto ngonobumba omncinci - umzekelo, firstName
  3. Kucetyiswa ukuba kusetyenziswe uhlobo lwesininzi lwamaqumrhu – umzekelo, abaSebenzi
  4. Kunconywa ukusebenzisa uhlobo olulodwa lweentlobo - umzekelo, Imali
  5. musa ukuphinda iimeko - umzekelo, Employees.name endaweni ethi Employees.EmployeeName
  6. khetha amagama anegama elinye - umzekelo, umvuzo endaweni yomvuzoIsixa
  7. sebenzisa i-ID kwizitshixo eziphambili zobugcisa - umzekelo, i-ID ye-ID yoMsebenzi
  8. Ungasebenzisa i-Namespace ukwenza amaqumrhu akho ahluke. Kufana nengcamango yomxhasi kwi-SAP apho unokuba ne-schemas ephindwe kabini (iifayile ze-cd) ezineSithuba segama esisodwa ukuzohlula. Izithuba zamagama azikhethwanga, sebenzisa izithuba zamagama ukuba imifuziselo yakho inokuphinda isetyenziswe kwezinye iiprojekthi. Ekupheleni kosuku zizimaphambili nje, ezithi zisetyenziswe ngokuzenzekelayo kuwo onke amagama afanelekileyo kwifayile. - umzekelo,

ilaptop yesithuba segama; umbutho uDell {}

..… ilingana no:

ilaptop.Dell {}

  1. Ungasebenzisa iimeko kumacandelo esithuba segama. - umzekelo,

ilaptop yesithuba segama; umbutho uDell {}           //> laptop.Dellumxholo Apple { iziko MacBookPro {}       //> laptop.Apple.MacBookPro     ikho iMacBookAir {}}

 

Amaziko

Amaqumrhu afana neetafile ezinezitshixo eziphambili. Singenza umsebenzi we-CRUD sisebenzisa la maZiko. Yigcine ithe tyaba kangangoko. Sukuyiqhelanisa ngokugqithisileyo. Musa ukusebenzisa iintlobo ezingasebenzisekiyo kwakhona. Eli candelo lelomzekelo kuphela, kuphela inkcazo enxulumene nemimandla yomntu ngamnye ekufuneka yongezwe kwaye akukho nkcukacha zobugcisa (ingqiqo) kufuneka zongezwe.

iintlobo

Iindidi zifana ne-Domain kwi-SAP ABAP, yayisetyenziselwa ukuchaza uhlobo lwezinto zeDatha.

Izinto

Imiba ngezandiso zeeModeli kwaye zisetyenziswa ikakhulu ukwandisa iinkcazo ezikhoyo kunye nezichasiselo. Xa imodeli ichaziwe, sinokusebenzisa iifayile zecd ezahlukeneyo (Umbono) ukongeza amanqakwana phezu kwazo ngomsebenzi othile.

Umzekelo-

  • cds-imodeli yakho yesizinda esisiseko, igcinwe icocekile, ilula kwaye iyaqondakala
  • uphicotho-imodeli.cds- yongeza iinkalo ezongezelelweyo ezifunekayo kuphicotho-zincwadi kwifayile
  • i-auth-model.cds– wongeza amanqakwana ogunyaziso.

Izitshixo eziphambili

Njengeetafile kunye ne-CDS kwi-SAP ABAP, sigcina izitshixo eziphambili zeQumrhu zisebenzisa igama elingundoqo ngundoqo.

Isitshixo esiphambili sinokuphinda sisetyenziswe kuyo yonke imodeli ngokusebenzisa indlela yeenkcazo eziqhelekileyo.

Singenza i-common.cds Umzekelo apho zonke iinkcazo eziqhelekileyo zinokugcinwa.

// iinkcazo eziqhelekileyo

iziko loMgangatho weZiko {ID engundoqo : UUID; } Ngoku ezi nkcazelo ziqhelekileyo zingaphinda zisetyenziswe njengangezantsi: usebenzisa i- { StandardEntity } ukusuka './common'; iqumrhu Umqeshwa : Iqumrhu elisemgangathweni {igama : Umtya; ... } Umphathi wequmrhu : Iqumrhu elisemgangathweni { igama : Umtya; ...}

 

Ifayile eqhelekileyo sele yenziwe ngokungagqibekanga ngequmrhu elichazwe kwangaphambili elinegama cuid.

Imephu ye-UUIDs ukuya kwi-OData

I-CDS imephu ye-UUIDs ukuya ku-Edm.Guid, ngokungagqibekanga, kuyo yonke imifuziselo ye-OData. Nangona kunjalo, umgangatho we-OData ubeka imithetho ethintelayo ye-Edm.Guid values ​​- umzekelo, kuphela iintambo ezidibeneyo zivumelekile - ezinokungqubuzana nedatha ekhoyo. Ke ngoko, sivumela imephu engagqibekanga ibhalwe ngolu hlobo lulandelayo:

Iincwadi ezikhoyo {

isitshixo ID : UUID @odata.Udidi:'Edm.String';

...

}

Ukuba kuyimfuneko, unokongeza kwakhona i-annotation @ odata.MaxLength ukugqithisa ipropati ehambelanayo, nayo.

association

Isetyenziselwa ukuchaza ubudlelwane phakathi kwezinto ezimbini. Njenge ABAP CDS, nalapha sisebenzisa igama Umbutho. Apha, igama elingundoqo ezininzi ibonisa 0..* ubukhadinali. Izithintelo zekhadinali zingadityaniswa njengesithintelo (apho imeko) - umzekelo, ukusebenzisa hayi null.

nokwenziwa kwayo

Ngokungafaniyo noMbutho apho sinxulumanisa icandelo lequmrhu kunye nezinto zequmrhu lilonke, iingoma zibhekisa kwindawo ethile yelinye iziko. Inenzuzo eyongezelelweyo yemisebenzi enzulu yokulawula ngokwayo (Faka / Hlaziya) kunye nocimo olucinyiweyo (Ukucinywa kwetafile exhomekeke kwiMulti).

// Chaza ii-odolo ezinee-odolo eziqulethweyoii-odolo zeziko {ID engundoqo: UUID; Izinto : Ukudityaniswa kwezinto ezininzi eziOrder_kwizinto // iya kufumaneka ngeeMiyalelo kuphela  umzali ongundoqo : Umbutho kwiMiyalelo; incwadi engundoqo : Umbutho kwiiNcwadi; ubungakanani : Inani elipheleleyo;}

IiNdlela zokusebenza ezilungileyo

  1. Musa ukongeza iinkcukacha zobugcisa kwiiModeli, sisebenzisa Izintongalo nto
  2. ukusebenzisa amagama amafutshane kwaye iimodeli ezilula ezizicaba
  3. Ungagqithisi ngokuQinisekisa amaqumrhu kwiiModeli
  4. Sebenzisa ulandelelwano olupheleleyo lwasekuhlaleni ukuba ngenene ujongana nemithwalo ephezulu kunye nemithamo. Kungenjalo, khetha ii-UUIDs

Ukuza kuthi ga ngoku oko sikufundileyo: Ukudalwa koMzekelo kunye neMiba ngaphezulu kwayo.

I-Domain Modeling kwi-SAP CAP

Ushiye uluvo

Le sayithi isebenzisa i-Akismet ukunciphisa ugaxekile. Funda indlela idatha yakho yokubhaliweyo isetyenziswe ngayo.