Ukumodela Kwesizinda ku-SAP CAP

Isingeniso

I-Domain Model ku-SAP CAP imodeli echaza izici ezimile, ezihlobene nedatha zesizinda senkinga ngokuya ngamamodeli obudlelwano bebhizinisi. Kulesi sihloko sizofunda i-Domain Modeling ku-SAP CAP ngokuningiliziwe.

Ukumodela Kwesizinda

Ngamazwi alula, i-CDS ku-SAP CAP ikhiqiza imodeli yesizinda ngendlela yokuthi ichaza inkinga yebhizinisi mayelana nezihluthulelo, izinkambu nezichasiselo. Ikhodi yokukhiqiza imodeli yesizinda ibhalwe ku-schema se-CDS (db/schema.cds). Lawa mamodeli wesizinda angasetshenziswa Ezincazelweni Zesevisi, Amamodeli Okuphikelela, Izizindalwazi noma aphinde asetshenziswe ngaphakathi kwenye imodeli yesizinda.

Isibonelo Sesampuli:

I-Namespace empInfo; usebenzisa okuthi {Currency, managed} kusuka ku-'@sap/cds/common'; inhlangano Abasebenzi: iphethwe {ID engukhiye: Integer; firstName: Uchungechunge lwendawo (111); isibongo: Uchungechunge lwendawo (1111); umphathi: Inhlangano kubaphathi; idethi yokuJoyina: Inombolo ephelele; iholo: Idesimali (9,2); uhlobo lwemali: Imali; }

 

Kulesi sibonelo sakhe ifayela elithi schema.cds lapho sidale khona Inhlangano Abasebenzi ehlanganisa imininingwane eyisisekelo Yesisebenzi.

Sonke lesi schema sinikezwe indawo yegama okungukuthi i-empInfo

Lolu hlelo lusebenzisa uhlobo lwedatha olujwayelekile okungukuthi Imali. Ukusebenzisa uhlobo lwedatha olujwayelekile olufana nalolu kusisiza ukuthi silethe lonke usizo oluchazwe ngaphambilini oluhlobene nalo.

Sisebenzisa i-CDS ukuze sakhe Imodeli. Kuleyo CDS, sisebenzisa

  1. Amabhizinisi azomela isethi yezinto ezihlukile isb:
    1. Ulwazi Oluyisisekelo Lwabasebenzi
    2. Ulwazi Lokuxhumana Kwabasebenzi
    3. Ulwazi Lwemiholo Yabasebenzi
  2. Izinhlangano ezichaza ubudlelwano
    1. Ukuhlotshaniswa komphathi kwenye Umphathi webhizinisi ozoba nalo lonke uhlu lwabaphathi

Umhlangano Wokuqamba Nezincomo

  1. Igama lebhizinisi kufanele liqale ngosonhlamvukazi futhi kufanele lifundeke umuntu futhi lizichazele lona - isibonelo, Abasebenzi.
  2. Qala izinto ngohlamvu oluncane - isibonelo, firstName
  3. Kunconywa ukusebenzisa ubuningi bezinhlangano - isibonelo, Abasebenzi
  4. Kunconywa ukusebenzisa uhlobo olulodwa lwezinhlobo - isibonelo, Imali
  5. ungaphindi izingqikithi - isibonelo, Employees.name esikhundleni sokuthi Employees.EmployeeName
  6. khetha amagama anegama elilodwa - isibonelo, iholo esikhundleni semaliInani
  7. sebenzisa i-ID ngokhiye abayinhloko bezobuchwepheshe - isibonelo, i-ID ye-ID Yesisebenzi
  8. Ungasebenzisa i-Namespace ukuze wenze amabhizinisi akho ahluke. Kufana nomqondo weklayenti ku-SAP lapho ungaba nezikimu eziyimpinda (amafayela ama-cd) ane-Namespace ehlukile ukuze uwahlukanise. Izikhala zamagama zingokuzithandela, sebenzisa izikhala zamagama uma amamodeli akho engase aphinde asetshenziswe kwamanye amaphrojekthi. Ekupheleni kosuku ziyiziqalo nje, ezisetshenziswa ngokuzenzakalelayo kuwo wonke amagama abalulekile efayelini. - Ngokwesibonelo,

ikhompyutha ephathekayo yesikhala segama;inkampani iDell {}

..… kulingana nokuthi:

ilaptop yebhizinisi.Dell {}

  1. Ungasebenzisa okuqukethwe kwezigaba ze-namespace esidleke. - Ngokwesibonelo,

ikhompyutha ephathekayo yesikhala segama;inkampani iDell {}           //> ikhompyutha ephathekayo.Dellumongo Apple { entity MacBookPro {}       //> ikhompyutha ephathekayo.Apple.MacBookPro     inkampani MacBookAir {}}

 

Amabhizinisi

Amabhizinisi afana namathebula anokhiye abayinhloko. Singenza umsebenzi we-CRUD sisebenzisa lezi zinkampani. Yigcine iphansi ngangokunokwenzeka. Ungakujwayeli ngokwedlulele. Ungasebenzisi izinhlobo ezingasebenziseki kabusha. Lesi sigaba esokwenza imodeli kuphela, kufanele kwengezwe kuphela isichasiselo esihlobene nezinkambu ezingazodwana futhi akukho mininingwane yobuchwepheshe (amacebo) okufanele yengezwe.

izinhlobo

Izinhlobo zifana ne-Domain ku-SAP ABAP, yayivame ukuchaza uhlobo lwezinto zedatha.

Izici

Izici izandiso zamamodeli futhi zisetshenziswa kakhulu ukuze kunwetshwe izincazelo ezikhona nezichasiselo. Uma imodeli isichaziwe, singasebenzisa amafayela e-cd ahlukene (I-Aspect) ukuze sengeze izichasiselo phezu kwawo ngomsebenzi othile.

Ngokwesibonelo-

  • CD- imodeli yakho yesizinda esiyinhloko, igcinwe ihlanzekile, ilula futhi iyaqondakala
  • audit-model.cd– wengeza izinkambu ezengeziwe ezidingekayo ukuze kucwaningwe efayeleni
  • i-auth-model.cds– wengeza izichasiselo zokugunyazwa.

Okhiye Abayinhloko

Njengamathebula nama-CDS ku-SAP ABAP, sigcina okhiye Abayinhloko Bebhizinisi sisebenzisa igama elingukhiye ukhiye.

Ukhiye oyinhloko ungasetshenziswa kabusha kuyo yonke imodeli ngokusebenzisa indlela yezincazelo ezivamile.

Singakha i-common.cds Model lapho zonke izincazelo ezivamile zingagcinwa khona.

// izincazelo ezivamile

ibhizinisi StandardEntity { ID key : UUID; } Manje lezi zincazelo ezivamile zingasetshenziswa kabusha njengoba ngezansi: kusetshenziswa i-{ StandardEntity } kusuka ku-'./common'; ibhizinisi Isisebenzi : StandardEntity { igama : String; ... } Umphathi webhizinisi : StandardEntity { igama : Iyunithi yezinhlamvu; ...}

 

Ifayela elivamile selivele lakhiwe ngokuzenzakalelayo ngebhizinisi elichazwe ngaphambilini eliqanjwe igama cuid.

Imephu ye-UUID ibe yi-OData

I-CDS yenza imephu ye-UUID iye ku-Edm.Guid, ngokuzenzakalelayo, kuwo wonke amamodeli we-OData. Nokho, izinga le-OData libeka imithetho evimbelayo yamanani e-Edm.Guid - isibonelo, amayunithi ezinhlamvu axhumene kuphela avunyelwe - angase angqubuzane nedatha ekhona. Ngakho-ke, sivumela ukuhlelwa kwemephu okuzenzakalelayo ukuthi kukhishwe ngale ndlela elandelayo:

Izincwadi zebhizinisi {

I-ID yokhiye: UUID @odata.Uhlobo:'Edm.String';

...

}

Uma kudingeka, ungakwazi futhi ukwengeza isichasiselo esithi @odata.MaxLength ukuze ukhiphe impahla ehambisanayo, futhi.

Association

Isetshenziselwa ukuchaza ubudlelwano phakathi kwezinhlangano ezimbili. Njenge-ABAP CDS, nalapha sisebenzisa igama Inhlangano. Lapha, igama elingukhiye abaningi ikhombisa a 0..* ubukhadinali. Imikhawulo yekhadinali ingangezwa njengesithiyo (lapho isimo) - isibonelo, ukusebenzisa hhayi null.

Ukwakhiwa

Ngokungafani neNhlangano lapho sihlobanisa inkambu yebhizinisi nezinto zebhizinisi lonke, okubhaliwe kuvele kubhekisele kunkambu ethile yelinye ibhizinisi. Inenzuzo eyengeziwe yokusebenza okujulile okuzilawulayo(Faka/Buyekeza) kanye nokususwa okucashile(Ukususwa kwetafula Okuncike Kaningi).

// Chaza Ama-oda anama-OrderItems aqukethweAma-oda ebhizinisi {ID yokhiye : UUID; Izinto : Ukwakhiwa Kwezinto Ezi-Order_eziningi Ezintweni.parent=$self;}Izinto Zoku-oda_zebhizinisi { // izotholwa ngama-oda kuphela  umzali obalulekile : Inhlangano kuma-oda; incwadi eyisihluthulelo : Ukuhlangana Nezincwadi; ubuningi : Inombolo ephelele;}

Izindlela Ezinhle Kakhulu

  1. Ungangezi imininingwane yobuchwepheshe kumamodeli, sisebenzisa Izicingalokho
  2. Sebenzisa amagama amafushane futhi amamodeli alula ayisicaba
  3. Ungawenzi Ngokwejwayelekile amabhizinisi Kumamodeli
  4. Sebenzisa ukulandelana kwezinombolo zasendaweni uma ngempela ubhekana nemithwalo ephezulu namavolumu. Uma kungenjalo, khetha ama-UUID

Kuze kube manje esikufundile: Ukudalwa Kwemodeli Nezici phezu kwayo .

Ukumodela Kwesizinda ku-SAP CAP

Shiya amazwana

Le sayithi isebenzisa i-Akismet ukunciphisa ugaxekile. Funda ukuthi idatha yakho yokuphawula isetshenziswa kanjani.