KursblockungInput.ts 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. import { JavaObject, cast_java_lang_Object } from '../../../java/lang/JavaObject';
  2. import { KursblockungInputKurs, cast_de_nrw_schule_svws_core_data_kursblockung_KursblockungInputKurs } from '../../../core/data/kursblockung/KursblockungInputKurs';
  3. import { KursblockungInputSchueler, cast_de_nrw_schule_svws_core_data_kursblockung_KursblockungInputSchueler } from '../../../core/data/kursblockung/KursblockungInputSchueler';
  4. import { KursblockungInputRegel, cast_de_nrw_schule_svws_core_data_kursblockung_KursblockungInputRegel } from '../../../core/data/kursblockung/KursblockungInputRegel';
  5. import { KursblockungInputKursart, cast_de_nrw_schule_svws_core_data_kursblockung_KursblockungInputKursart } from '../../../core/data/kursblockung/KursblockungInputKursart';
  6. import { KursblockungInputFach, cast_de_nrw_schule_svws_core_data_kursblockung_KursblockungInputFach } from '../../../core/data/kursblockung/KursblockungInputFach';
  7. import { KursblockungInputFachwahl, cast_de_nrw_schule_svws_core_data_kursblockung_KursblockungInputFachwahl } from '../../../core/data/kursblockung/KursblockungInputFachwahl';
  8. import { Vector, cast_java_util_Vector } from '../../../java/util/Vector';
  9. export class KursblockungInput extends JavaObject {
  10. public enmRevision : number = -1;
  11. public input : number = 0;
  12. public maxTimeMillis : number = 0;
  13. public maxSchienen : number = 0;
  14. public regeln : Vector<KursblockungInputRegel> = new Vector();
  15. public faecher : Vector<KursblockungInputFach> = new Vector();
  16. public kursarten : Vector<KursblockungInputKursart> = new Vector();
  17. public kurse : Vector<KursblockungInputKurs> = new Vector();
  18. public schueler : Vector<KursblockungInputSchueler> = new Vector();
  19. public fachwahlen : Vector<KursblockungInputFachwahl> = new Vector();
  20. public constructor() {
  21. super();
  22. }
  23. isTranspiledInstanceOf(name : string): boolean {
  24. return ['de.nrw.schule.svws.core.data.kursblockung.KursblockungInput'].includes(name);
  25. }
  26. public static transpilerFromJSON(json : string): KursblockungInput {
  27. const obj = JSON.parse(json);
  28. const result = new KursblockungInput();
  29. if (typeof obj.enmRevision === "undefined")
  30. throw new Error('invalid json format, missing attribute enmRevision');
  31. result.enmRevision = obj.enmRevision;
  32. if (typeof obj.input === "undefined")
  33. throw new Error('invalid json format, missing attribute input');
  34. result.input = obj.input;
  35. if (typeof obj.maxTimeMillis === "undefined")
  36. throw new Error('invalid json format, missing attribute maxTimeMillis');
  37. result.maxTimeMillis = obj.maxTimeMillis;
  38. if (typeof obj.maxSchienen === "undefined")
  39. throw new Error('invalid json format, missing attribute maxSchienen');
  40. result.maxSchienen = obj.maxSchienen;
  41. if (!!obj.regeln) {
  42. for (let elem of obj.regeln) {
  43. result.regeln?.add(KursblockungInputRegel.transpilerFromJSON(JSON.stringify(elem)));
  44. }
  45. }
  46. if (!!obj.faecher) {
  47. for (let elem of obj.faecher) {
  48. result.faecher?.add(KursblockungInputFach.transpilerFromJSON(JSON.stringify(elem)));
  49. }
  50. }
  51. if (!!obj.kursarten) {
  52. for (let elem of obj.kursarten) {
  53. result.kursarten?.add(KursblockungInputKursart.transpilerFromJSON(JSON.stringify(elem)));
  54. }
  55. }
  56. if (!!obj.kurse) {
  57. for (let elem of obj.kurse) {
  58. result.kurse?.add(KursblockungInputKurs.transpilerFromJSON(JSON.stringify(elem)));
  59. }
  60. }
  61. if (!!obj.schueler) {
  62. for (let elem of obj.schueler) {
  63. result.schueler?.add(KursblockungInputSchueler.transpilerFromJSON(JSON.stringify(elem)));
  64. }
  65. }
  66. if (!!obj.fachwahlen) {
  67. for (let elem of obj.fachwahlen) {
  68. result.fachwahlen?.add(KursblockungInputFachwahl.transpilerFromJSON(JSON.stringify(elem)));
  69. }
  70. }
  71. return result;
  72. }
  73. public static transpilerToJSON(obj : KursblockungInput) : string {
  74. let result = '{';
  75. result += '"enmRevision" : ' + obj.enmRevision + ',';
  76. result += '"input" : ' + obj.input + ',';
  77. result += '"maxTimeMillis" : ' + obj.maxTimeMillis + ',';
  78. result += '"maxSchienen" : ' + obj.maxSchienen + ',';
  79. if (!obj.regeln) {
  80. result += '[]';
  81. } else {
  82. result += '[ ';
  83. for (let i : number = 0; i < obj.regeln.size(); i++) {
  84. let elem = obj.regeln.get(i);
  85. result += KursblockungInputRegel.transpilerToJSON(elem);
  86. if (i < obj.regeln.size() - 1)
  87. result += ',';
  88. }
  89. result += ' ]' + ',';
  90. }
  91. if (!obj.faecher) {
  92. result += '[]';
  93. } else {
  94. result += '[ ';
  95. for (let i : number = 0; i < obj.faecher.size(); i++) {
  96. let elem = obj.faecher.get(i);
  97. result += KursblockungInputFach.transpilerToJSON(elem);
  98. if (i < obj.faecher.size() - 1)
  99. result += ',';
  100. }
  101. result += ' ]' + ',';
  102. }
  103. if (!obj.kursarten) {
  104. result += '[]';
  105. } else {
  106. result += '[ ';
  107. for (let i : number = 0; i < obj.kursarten.size(); i++) {
  108. let elem = obj.kursarten.get(i);
  109. result += KursblockungInputKursart.transpilerToJSON(elem);
  110. if (i < obj.kursarten.size() - 1)
  111. result += ',';
  112. }
  113. result += ' ]' + ',';
  114. }
  115. if (!obj.kurse) {
  116. result += '[]';
  117. } else {
  118. result += '[ ';
  119. for (let i : number = 0; i < obj.kurse.size(); i++) {
  120. let elem = obj.kurse.get(i);
  121. result += KursblockungInputKurs.transpilerToJSON(elem);
  122. if (i < obj.kurse.size() - 1)
  123. result += ',';
  124. }
  125. result += ' ]' + ',';
  126. }
  127. if (!obj.schueler) {
  128. result += '[]';
  129. } else {
  130. result += '[ ';
  131. for (let i : number = 0; i < obj.schueler.size(); i++) {
  132. let elem = obj.schueler.get(i);
  133. result += KursblockungInputSchueler.transpilerToJSON(elem);
  134. if (i < obj.schueler.size() - 1)
  135. result += ',';
  136. }
  137. result += ' ]' + ',';
  138. }
  139. if (!obj.fachwahlen) {
  140. result += '[]';
  141. } else {
  142. result += '[ ';
  143. for (let i : number = 0; i < obj.fachwahlen.size(); i++) {
  144. let elem = obj.fachwahlen.get(i);
  145. result += KursblockungInputFachwahl.transpilerToJSON(elem);
  146. if (i < obj.fachwahlen.size() - 1)
  147. result += ',';
  148. }
  149. result += ' ]' + ',';
  150. }
  151. result = result.slice(0, -1);
  152. result += '}';
  153. return result;
  154. }
  155. public static transpilerToJSONPatch(obj : Partial<KursblockungInput>) : string {
  156. let result = '{';
  157. if (typeof obj.enmRevision !== "undefined") {
  158. result += '"enmRevision" : ' + obj.enmRevision + ',';
  159. }
  160. if (typeof obj.input !== "undefined") {
  161. result += '"input" : ' + obj.input + ',';
  162. }
  163. if (typeof obj.maxTimeMillis !== "undefined") {
  164. result += '"maxTimeMillis" : ' + obj.maxTimeMillis + ',';
  165. }
  166. if (typeof obj.maxSchienen !== "undefined") {
  167. result += '"maxSchienen" : ' + obj.maxSchienen + ',';
  168. }
  169. if (typeof obj.regeln !== "undefined") {
  170. if (!obj.regeln) {
  171. result += '[]';
  172. } else {
  173. result += '[ ';
  174. for (let i : number = 0; i < obj.regeln.size(); i++) {
  175. let elem = obj.regeln.get(i);
  176. result += KursblockungInputRegel.transpilerToJSON(elem);
  177. if (i < obj.regeln.size() - 1)
  178. result += ',';
  179. }
  180. result += ' ]' + ',';
  181. }
  182. }
  183. if (typeof obj.faecher !== "undefined") {
  184. if (!obj.faecher) {
  185. result += '[]';
  186. } else {
  187. result += '[ ';
  188. for (let i : number = 0; i < obj.faecher.size(); i++) {
  189. let elem = obj.faecher.get(i);
  190. result += KursblockungInputFach.transpilerToJSON(elem);
  191. if (i < obj.faecher.size() - 1)
  192. result += ',';
  193. }
  194. result += ' ]' + ',';
  195. }
  196. }
  197. if (typeof obj.kursarten !== "undefined") {
  198. if (!obj.kursarten) {
  199. result += '[]';
  200. } else {
  201. result += '[ ';
  202. for (let i : number = 0; i < obj.kursarten.size(); i++) {
  203. let elem = obj.kursarten.get(i);
  204. result += KursblockungInputKursart.transpilerToJSON(elem);
  205. if (i < obj.kursarten.size() - 1)
  206. result += ',';
  207. }
  208. result += ' ]' + ',';
  209. }
  210. }
  211. if (typeof obj.kurse !== "undefined") {
  212. if (!obj.kurse) {
  213. result += '[]';
  214. } else {
  215. result += '[ ';
  216. for (let i : number = 0; i < obj.kurse.size(); i++) {
  217. let elem = obj.kurse.get(i);
  218. result += KursblockungInputKurs.transpilerToJSON(elem);
  219. if (i < obj.kurse.size() - 1)
  220. result += ',';
  221. }
  222. result += ' ]' + ',';
  223. }
  224. }
  225. if (typeof obj.schueler !== "undefined") {
  226. if (!obj.schueler) {
  227. result += '[]';
  228. } else {
  229. result += '[ ';
  230. for (let i : number = 0; i < obj.schueler.size(); i++) {
  231. let elem = obj.schueler.get(i);
  232. result += KursblockungInputSchueler.transpilerToJSON(elem);
  233. if (i < obj.schueler.size() - 1)
  234. result += ',';
  235. }
  236. result += ' ]' + ',';
  237. }
  238. }
  239. if (typeof obj.fachwahlen !== "undefined") {
  240. if (!obj.fachwahlen) {
  241. result += '[]';
  242. } else {
  243. result += '[ ';
  244. for (let i : number = 0; i < obj.fachwahlen.size(); i++) {
  245. let elem = obj.fachwahlen.get(i);
  246. result += KursblockungInputFachwahl.transpilerToJSON(elem);
  247. if (i < obj.fachwahlen.size() - 1)
  248. result += ',';
  249. }
  250. result += ' ]' + ',';
  251. }
  252. }
  253. result = result.slice(0, -1);
  254. result += '}';
  255. return result;
  256. }
  257. }
  258. export function cast_de_nrw_schule_svws_core_data_kursblockung_KursblockungInput(obj : unknown) : KursblockungInput {
  259. return obj as KursblockungInput;
  260. }