Advertisement
Guest User

Untitled

a guest
May 27th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. Class Biblioteka.Wypozyczenie Extends (%Persistent, %Populate, %XML.Adaptor, %ZEN.DataModel.Adaptor)
  2. {
  3.  
  4. Property DataWypozyczenia As %Date [ Required ];
  5.  
  6. Relationship Czytelnik As Biblioteka.Czytelnik [ Cardinality = one, Inverse = Login ];
  7.  
  8. Relationship Ksiazka As Biblioteka.Ksiazka [ Cardinality = one, Inverse = IdKsiazki ];
  9.  
  10. Property CzyOddanaKsiazka As %Boolean [ Required ];
  11.  
  12. Method oddajKsiazke() As %String
  13. {
  14. IF ..CzyOddanaKsiazka = 0 {
  15. Set ..CzyOddanaKsiazka = 1
  16. Do %Save()
  17. Return "Zwrócono książkę"
  18. }
  19. ELSE {
  20. Return "Błąd podczas wykonywania operacji"
  21. }
  22. }
  23.  
  24. }
  25.  
  26.  
  27.  
  28.  
  29. Class Biblioteka.Czytelnik Extends Biblioteka.Osoba
  30. {
  31.  
  32. Relationship Login As Biblioteka.Wypozyczenie [ Cardinality = many, Inverse = Czytelnik, Required ];
  33.  
  34. }
  35.  
  36.  
  37.  
  38. Class Biblioteka.Ksiazka Extends (%Persistent, %Populate)
  39. {
  40.  
  41. Relationship IdKsiazki As Biblioteka.Wypozyczenie [ Cardinality = many, Inverse = Ksiazka, Required ];
  42.  
  43. Index IdKsiazkiIndex On IdKsiazki [ Unique ];
  44.  
  45. Property ISBN As %Numeric(MAXVAL = 9999999999999, MINVAL = 1000000000000) [ Required ];
  46.  
  47. Property Tytul As %String [ Required ];
  48.  
  49. Property Opis As %String;
  50.  
  51. Property RokWydania As %Date [ Required ];
  52.  
  53. Relationship Autor As Biblioteka.Autor [ Cardinality = one, Inverse = Ksiazki ];
  54.  
  55. Index AutorIndex On Autor;
  56.  
  57. Storage Default
  58. {
  59. <Data name="KsiazkaDefaultData">
  60. <Value name="1">
  61. <Value>%%CLASSNAME</Value>
  62. </Value>
  63. <Value name="2">
  64. <Value>ISBN</Value>
  65. </Value>
  66. <Value name="3">
  67. <Value>Tytul</Value>
  68. </Value>
  69. <Value name="4">
  70. <Value>Opis</Value>
  71. </Value>
  72. <Value name="5">
  73. <Value>RokWydania</Value>
  74. </Value>
  75. <Value name="6">
  76. <Value>IdKsiazki</Value>
  77. </Value>
  78. <Value name="7">
  79. <Value>Autor</Value>
  80. </Value>
  81. </Data>
  82. <DataLocation>^Biblioteka.KsiazkaD</DataLocation>
  83. <DefaultData>KsiazkaDefaultData</DefaultData>
  84. <IdLocation>^Biblioteka.KsiazkaD</IdLocation>
  85. <IndexLocation>^Biblioteka.KsiazkaI</IndexLocation>
  86. <StreamLocation>^Biblioteka.KsiazkaS</StreamLocation>
  87. <Type>%Library.CacheStorage</Type>
  88. }
  89.  
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement