Datenwürfel für SuperX
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

408 lines
16 KiB

--freemarker template
<#assign xcubes = [
{"name":"Studierendenwürfel",
"uniquename":"xcube_sos_stg_aggr",
"sachgebiet":16,
"table_name":"sos_stg_aggr",
"maskeninfo_id":21000
} ,
{"name":"Prüfungswürfel",
"uniquename":"xcube_sos_lab_aggr",
"sachgebiet":16,
"table_name":"sos_lab_aggr",
"maskeninfo_id":21100
} ,
{"name":"Primärbuchungswürfel",
"uniquename":"xcube_cob_busa_aggr",
"sachgebiet":27,
"table_name":"cob_busa_aggr",
"maskeninfo_id":21500
}
] />
<#assign xcube_kennzahl = [
{ "maskeninfo_id":21000,
"apnr":"stud",
"name":"Studierende",
"aggrfunction":"sum(summe)",
"restriction":"",
"datatype":"integer",
"is_default":1,
"sortnr":1},
{ "maskeninfo_id":21100,
"apnr":"pruef",
"name":"Prüfungen",
"aggrfunction":"sum(summe)",
"restriction":"",
"datatype":"integer",
"is_default":1,
"sortnr":1},
{ "maskeninfo_id":21500,
"apnr":"kosten",
"name":"Kosten",
"aggrfunction":"sum(betrag*kokl_faktor)",
"restriction":"",
"is_default":1,
"sortnr":1}
] />
<#assign xcube_dimconfig = [
{"maskeninfo_id":21000,
"name":"fach_sem_zahl",
"caption":"Fachsemester",
"is_rowdefault":1,
"foreignkey_tab":"xcube_dims",
"foreignkey_col":"apnr",
"foreignkey_cap":"name",
"foreignkey_cond":"id='fssemzahl'",
"attrib_nachbearbeitung": "update <<tmp_table>> set <<col>>='99' where <<col>>::integer > 10",
"sortfield":"sort1"},
{"maskeninfo_id":21000,
"name":"hssem",
"caption":"Hochschulsemester",
"foreignkey_tab":"xcube_dims",
"foreignkey_col":"apnr",
"foreignkey_cap":"name",
"foreignkey_cond":"id='hssemzahl'",
"attrib_nachbearbeitung": "update <<tmp_table>> set <<col>>='999' where <<col>>::integer > 10; update <<tmp_table>> set <<col>>='0' where <<col>>::integer <0",
"sortfield":"sort1"},
{"maskeninfo_id":21000,
"name":"geschlecht",
"caption":"Geschlecht",
"is_coldefault":1,
"foreignkey_tab":"sos_k_geschl",
"foreignkey_col":"apnr::varchar(255)",
"foreignkey_cap":"druck",
"foreignkey_cond":"apnr in ('1','2')",
"sortfield":"apnr"},
{"maskeninfo_id":21000,
"name":"tid_stg",
"caption":"Studiengang",
"is_sicht":1,
"attrib_nachbearbeitung": "update <<tmp_table>> set <<col>>='s_'||<<col>>"},
{"maskeninfo_id":21000,
"name":"ca12_staat",
"caption":"Staatsangehörigkeit",
"is_sicht":1 },
{"maskeninfo_id":21000,
"name":"abschluss",
"caption":"Abschluss",
"is_virtual":1,
"vcsql":"update tmp_rohdaten set abschluss=(select abschluss from dim_studiengang where tid=tid_stg)",
"is_sicht":1},
{"maskeninfo_id":21000,
"name":"sem_rueck_beur_ein",
"caption":"Semester",
"foreignkey_tab":"semester",
"foreignkey_col":"tid",
"foreignkey_cap":"eintrag",
"sortfield":"tid",
"calc_gesamt":0},
{"maskeninfo_id":21000,
"name":"hzbart",
"caption":"Hochschulzugangsberechtigung",
"foreignkey_tab":"hs_zugangsber",
"foreignkey_col":"tid::varchar(255)",
"foreignkey_cap":"eintrag",
"sortfield":"tid"},
{"maskeninfo_id":21000,
"name":"semkfz",
"caption":"Wohnort",
"is_coldim":0,
"is_sicht":1 },
{"maskeninfo_id":21000,
"name":"alter",
"caption":"Alter",
"is_sicht":2},
{"maskeninfo_id":21000,
"name":"aktiv",
"caption":"Aktiv",
"foreignkey_tab":"xcube_dims",
"foreignkey_col":"apnr",
"foreignkey_cap":"name",
"foreignkey_cond":"id='aktiv'",
"sortfield":"sort1"},
{"maskeninfo_id":21000,
"name":"hrst",
"caption":"Hörerstatus (intern)",
"is_sicht":1},
{"maskeninfo_id":21000,
"name":"ch27_grund_beurl",
"caption":"Beurlaubungsgrund",
"foreignkey_tab":"cifx",
"foreignkey_col":"apnr::varchar(255)",
"foreignkey_cap":"druck",
"foreignkey_cond":"key=27",
"sortfield":"druck"},
{"maskeninfo_id":21000,
"name":"hzbart_int",
"caption":"HZB (intern)",
"is_coldim":0,
"foreignkey_tab":"k_hzbart",
"foreignkey_col":"hzbart::varchar(255)",
"foreignkey_cap":"dtxt",
"sortfield":"dtxt"},
{"maskeninfo_id":21000,
"name":"hzbnote",
"caption":"HZB-Note",
"is_sicht":2},
{"maskeninfo_id":21000,
"name":"fb",
"caption":"Fachbereich/Fakultät",
"is_virtual":1,
"vcsql":"update tmp_rohdaten set fb=(select fb from dim_studiengang where tid=tid_stg)",
"foreignkey_tab":"cifx",
"foreignkey_col":"apnr::varchar(255)",
"foreignkey_cap":"druck",
"foreignkey_cond":"key=90",
"sortfield":"druck"},
{"maskeninfo_id":21000,
"name":"lehr",
"caption":"Lehreinheit",
"is_virtual":1,
"vcsql":"update tmp_rohdaten set lehr=(select lehr from dim_studiengang where tid=tid_stg)",
"foreignkey_tab":"xcube_dims",
"foreignkey_col":"apnr",
"foreignkey_cap":"name",
"foreignkey_cond":"id='lehr'",
"sortfield":"name"},
{"maskeninfo_id":21000,
"name":"stort",
"caption":"Standort",
"is_virtual":1,
"vcsql":"update tmp_rohdaten set stort=(select stort from dim_studiengang where tid=tid_stg)",
"foreignkey_tab":"cifx",
"foreignkey_col":"apnr::varchar(255)",
"foreignkey_cap":"druck",
"foreignkey_cond":"key=306",
"sortfield":"druck"},
{"maskeninfo_id":21000,
"name":"stutyp",
"caption":"Studientyp",
"foreignkey_tab":"cifx",
"foreignkey_col":"apnr::varchar(255)",
"foreignkey_cap":"druck",
"foreignkey_cond":"key=40",
"sortfield":"druck"},
{"maskeninfo_id":21000,
"name":"stg",
"caption":"Fach",
"is_virtual":1,
"is_coldim":0,
"vcsql":"update tmp_rohdaten set stg=(select stg from dim_studiengang where tid=tid_stg)",
"foreignkey_tab":"k_stg",
"foreignkey_col":"stg",
"foreignkey_cap":"ltxt",
"sortfield":"ltxt"},
{"maskeninfo_id":21000,
"name":"kz_rueck_beur_ein",
"caption":"Status",
"foreignkey_tab":"cifx",
"foreignkey_col":"hiskey_id::varchar(255)",
"foreignkey_cap":"druck",
"foreignkey_cond":"key=9001",
"sortfield":"druck"},
<#--Entwicklung Prüfungswürfel-->
{"maskeninfo_id":21100,
"name":"geschlecht",
"caption":"Geschlecht",
"is_coldefault":1,
"foreignkey_tab":"sos_k_geschl",
"foreignkey_col":"apnr::varchar(255)",
"foreignkey_cap":"druck",
"foreignkey_cond":"apnr in ('1','2')",
"sortfield":"apnr"},
{"maskeninfo_id":21100,
"name":"tid_stg",
"caption":"Studiengang",
"is_rowdefault":1,
"is_sicht":1,
"attrib_nachbearbeitung": "update <<tmp_table>> set <<col>>='s_'||<<col>>"},
{"maskeninfo_id":21100,
"name":"ca12_staat",
"caption":"Staatsangehörigkeit",
"is_sicht":1 },
{"maskeninfo_id":21100,
"name":"abschluss",
"caption":"Abschluss",
"is_virtual":1,
"vcsql":"update tmp_rohdaten set abschluss=(select abschluss from dim_studiengang where tid=tid_stg)",
"is_sicht":1},
{"maskeninfo_id":21100,
"name":"sem_der_pruefung",
"caption":"Semester",
"foreignkey_tab":"semester",
"foreignkey_col":"tid",
"foreignkey_cap":"eintrag",
"sortfield":"tid",
"calc_gesamt":0},
{"maskeninfo_id":21100,
"name":"hzbart",
"caption":"Hochschulzugangsberechtigung",
"is_coldefault":1,
"foreignkey_tab":"hs_zugangsber",
"foreignkey_col":"tid::varchar(255)",
"foreignkey_cap":"eintrag",
"sortfield":"tid"},
{"maskeninfo_id":21100,
"name":"stort",
"caption":"Standort",
"is_virtual":1,
"vcsql":"update tmp_rohdaten set stort=(select stort from dim_studiengang where tid=tid_stg)",
"foreignkey_tab":"cifx",
"foreignkey_col":"apnr::varchar(255)",
"foreignkey_cap":"druck",
"foreignkey_cond":"key=306",
"sortfield":"druck"},
{"maskeninfo_id":21100,
"name":"alter",
"caption":"Alter",
"is_sicht":2},
{"maskeninfo_id":21100,
"name":"note",
"caption":"Note",
"is_sicht":2},
{"maskeninfo_id":21100,
"name":"stg",
"caption":"Fach",
"is_virtual":1,
"is_coldim":0,
"vcsql":"update tmp_rohdaten set stg=(select stg from dim_studiengang where tid=tid_stg)",
"foreignkey_tab":"k_stg",
"foreignkey_col":"stg",
"foreignkey_cap":"ltxt",
"sortfield":"ltxt"},
{"maskeninfo_id":21100,
"name":"fb",
"caption":"Fachbereich/Fakultät",
"is_virtual":1,
"vcsql":"update tmp_rohdaten set fb=(select fb from dim_studiengang where tid=tid_stg)",
"foreignkey_tab":"cifx",
"foreignkey_col":"apnr::varchar(255)",
"foreignkey_cap":"druck",
"foreignkey_cond":"key=90",
"sortfield":"druck"},
{"maskeninfo_id":21100,
"name":"lehr",
"caption":"Lehreinheit",
"is_virtual":1,
"vcsql":"update tmp_rohdaten set lehr=(select lehr from dim_studiengang where tid=tid_stg)",
"foreignkey_tab":"xcube_dims",
"foreignkey_col":"apnr",
"foreignkey_cap":"name",
"foreignkey_cond":"id='lehr'",
"sortfield":"name"},
{"maskeninfo_id":21100,
"name":"dauer_rsz",
"caption":"Stud.Dauer im Verhältnis zur RSZ",
"is_virtual":1,
"vcsql":"update tmp_rohdaten set dauer_rsz= nvl(fach_sem_zahl -(select regel from dim_studiengang where tid=tid_stg),0)",
"foreignkey_tab":"xcube_dims",
"foreignkey_col":"apnr",
"foreignkey_cap":"name",
"foreignkey_cond":"id='dauer_rsz'",
"attrib_nachbearbeitung":"update <<tmp_table>> set <<col>>='-1' where <<col>>::numeric(5,2) <0.00;update <<tmp_table>> set <<col>>=<<col>>::numeric(5,2)::integer::varchar(10) where <<col>>::numeric(5,2) >=0.00 and <<col>>::numeric(5,2)< 2.00;update <<tmp_table>> set <<col>>='2' where <<col>>::numeric(5,2) >=2.00",
"sortfield":"sort1"},
{"maskeninfo_id":21100,
"name":"fach_sem_zahl",
"caption":"Fachsemester",
"is_rowdefault":1,
"foreignkey_tab":"xcube_dims",
"foreignkey_col":"apnr",
"foreignkey_cap":"name",
"foreignkey_cond":"id='fssemzahl'",
"attrib_nachbearbeitung": "update <<tmp_table>> set <<col>>=<<col>>::numeric(10,2)::integer::char where <<col>>::numeric(10,2) < 11.00;update <<tmp_table>> set <<col>>='99' where <<col>>::numeric(10,2) >= 11.00",
"sortfield":"sort1"},
{"maskeninfo_id":21100,
"name":"pstatus",
"caption":"Prüfungsstatus",
"foreignkey_tab":"sos_k_pstatus",
"foreignkey_col":"apnr::varchar(255)",
"foreignkey_cap":"druck",
"sortfield":"druck"},
<#-- Primärbuchungswürfel -->
{"maskeninfo_id":21500,
"name":"jahr",
"caption":"Jahr",
"is_coldefault":1,
"foreignkey_tab":"xcube_dims",
"foreignkey_col":"apnr",
"foreignkey_cap":"name",
"foreignkey_cond":"id='cob_jahr'",
"sortfield":"sort1"},
{"maskeninfo_id":21500,
"name":"monat",
"caption":"Monat",
"foreignkey_tab":"xcube_dims",
"foreignkey_col":"apnr",
"foreignkey_cap":"name",
"foreignkey_cond":"id='monat'",
"sortfield":"sort1"},
{"maskeninfo_id":21500,
"name":"ch110_institut",
"caption":"Kostenstelle",
"is_rowdefault":1,
"is_sicht":1 },
{"maskeninfo_id":21500,
"name":"fikrkey",
"caption":"Kostenarten",
"is_sicht":1 },
{"maskeninfo_id":21500,
"name":"ggnr",
"caption":"Geldgeber",
"is_sicht":1 },
{"maskeninfo_id":21500,
"name":"projnr",
"caption":"Kostenträger",
"is_sicht":1 }
] />
--freemarker magic
<#foreach cube in xcubes>
delete from xcube where maskeninfo_id=${cube.maskeninfo_id};
delete from xcube_dimconfig where maskeninfo_id=${cube.maskeninfo_id};
delete from xcube_kennzahl where maskeninfo_id=${cube.maskeninfo_id};
insert into xcube (name,uniquename,table_name,maskeninfo_id,sachgebiet)
values ('${cube.name}','${cube.uniquename}','${cube.table_name}',${cube.maskeninfo_id},${cube.sachgebiet});
</#foreach>
<#foreach k in xcube_kennzahl>
insert into xcube_kennzahl (apnr,name,maskeninfo_id,aggrfunction,restriction,is_default,sortnr) values
('${k.apnr}','${k.name}',${k.maskeninfo_id},'${k.aggrfunction?replace("\x0027","\x0027\x0027")}',
'${k.restriction?replace("\x0027","\x0027\x0027")}',
${k.is_default},${k.sortnr});
<#if k?keys?seq_contains("datatype")> update xcube_kennzahl set datatype='${k.datatype}' where maskeninfo_id='${k.maskeninfo_id}' and apnr='${k.apnr}';</#if>
</#foreach>
<#foreach conf in xcube_dimconfig>
-- einfache durch zwei einfache Zeichen ersetzten x0027
insert into xcube_dimconfig (maskeninfo_id,name,caption)
values (${conf.maskeninfo_id},'${conf.name}','${conf.caption?replace("\x0027","\x0027\x0027")}');
<#if conf?keys?seq_contains("foreignkey_tab")> update xcube_dimconfig set foreignkey_tab='${conf.foreignkey_tab}' where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}';</#if>
<#if conf?keys?seq_contains("foreignkey_cap")> update xcube_dimconfig set foreignkey_cap='${conf.foreignkey_cap}' where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}';</#if>
<#if conf?keys?seq_contains("foreignkey_col")> update xcube_dimconfig set foreignkey_col='${conf.foreignkey_col}' where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}';</#if>
<#if conf?keys?seq_contains("sortfield")> update xcube_dimconfig set sortfield='${conf.sortfield}' where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}';</#if>
<#if conf?keys?seq_contains("is_sicht")> update xcube_dimconfig set is_sicht=${conf.is_sicht} where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}';</#if>
<#if conf?keys?seq_contains("calc_gesamt")> update xcube_dimconfig set calc_gesamt=${conf.calc_gesamt} where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}';</#if>
<#if conf?keys?seq_contains("is_rowdim")> update xcube_dimconfig set is_rowdim=${conf.is_rowdim} where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}';</#if>
<#if conf?keys?seq_contains("is_secondrowdim")> update xcube_dimconfig set is_secondrowdim=${conf.is_secondrowdim} where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}';</#if>
<#if conf?keys?seq_contains("is_rowdefault")> update xcube_dimconfig set is_rowdefault=${conf.is_rowdefault} where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}';</#if>
<#if conf?keys?seq_contains("is_coldim")> update xcube_dimconfig set is_coldim=${conf.is_coldim} where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}';</#if>
<#if conf?keys?seq_contains("is_secondcoldim")> update xcube_dimconfig set is_secondcoldim=${conf.is_secondcoldim} where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}';</#if>
<#if conf?keys?seq_contains("is_coldefault")> update xcube_dimconfig set is_coldefault=${conf.is_coldefault} where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}';</#if>
<#if conf?keys?seq_contains("foreignkey_cond")> update xcube_dimconfig set foreignkey_cond='${conf.foreignkey_cond?replace("\x0027","\x0027\x0027")}' where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}';</#if>
<#if conf?keys?seq_contains("is_virtual")> update xcube_dimconfig set is_virtual=${conf.is_virtual} where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}';</#if>
<#if conf?keys?seq_contains("vcsql")> update xcube_dimconfig set vcsql='${conf.vcsql?replace("\x0027","\x0027\x0027")}' where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}';</#if>
<#if conf?keys?seq_contains("attrib_nachbearbeitung")> update xcube_dimconfig set attrib_nachbearbeitung='${conf.attrib_nachbearbeitung?replace("\x0027","\x0027\x0027")}' where maskeninfo_id='${conf.maskeninfo_id}' and name='${conf.name}';</#if>
</#foreach>