Browse Source

Installation/Upgrade von Sichten, kosmetische Änderungen im Quellcode #1

xcube0.1
Daniel Quathamer 2 years ago
parent
commit
a4f042e1fd
  1. 2
      src-modules/module/xcube/conf/xcube.xml
  2. 4
      src-modules/module/xcube/masken/21000_felderinfo.unl
  3. 83
      src-modules/module/xcube/masken/21000_maskeninfo.unl
  4. 124
      src-modules/module/xcube/schluesseltabellen/sichten_fuellen.sql
  5. 4
      src-modules/module/xcube/schluesseltabellen/xcube_install.sql
  6. 4
      src-modules/module/xcube/xcube_sichten.sql

2
src-modules/module/xcube/conf/xcube.xml

@ -155,6 +155,7 @@ parent="xCubes">Abfragen zur Administration von xCubes </thema> @@ -155,6 +155,7 @@ parent="xCubes">Abfragen zur Administration von xCubes </thema>
<nativeaction sql="" scriptfile="$XCUBE_PFAD/schluesseltabellen/xcube_install.sql" database=""/>
<nativeaction sql="" scriptfile="$XCUBE_PFAD/schluesseltabellen/xcube_install_restrictions.sql" database=""/>
<nativeaction sql="" scriptfile="$XCUBE_PFAD/schluesseltabellen/xcube_dims_install.sql" database=""/>
<nativeaction sql="" scriptfile="$XCUBE_PFAD/schluesseltabellen/sichten_fuellen.sql" database=""/>
</action>
</install-step>
</install>
@ -165,6 +166,7 @@ parent="xCubes">Abfragen zur Administration von xCubes </thema> @@ -165,6 +166,7 @@ parent="xCubes">Abfragen zur Administration von xCubes </thema>
<nativeaction sql="" scriptfile="$XCUBE_PFAD/schluesseltabellen/xcube_install.sql" database=""/>
<nativeaction sql="" scriptfile="$XCUBE_PFAD/schluesseltabellen/xcube_install_restrictions.sql" database=""/>
<nativeaction sql="" scriptfile="$XCUBE_PFAD/schluesseltabellen/xcube_dims_install.sql" database=""/>
<nativeaction sql="" scriptfile="$XCUBE_PFAD/schluesseltabellen/sichten_fuellen.sql" database=""/>
</action>
</upgrade-step>

4
src-modules/module/xcube/masken/21000_felderinfo.unl

@ -42,5 +42,5 @@ and trim(F.table_name) || '.' || F.name in (select trim(tablename)||'.'||trim(fi @@ -42,5 +42,5 @@ and trim(F.table_name) || '.' || F.name in (select trim(tablename)||'.'||trim(fi
21021^Abschluss^7^0^0^140^170^5^char^30^0^1^<<SQL>> select abint,dtxt from k_abint order by 2;^^^
21022^Kennzahl^3000^350^-1^150^180^1^integer^200^1^1^<<SQL>> select tid,name from xcube_kennzahl where maskeninfo_id=${Maskennummer} order by sortnr,name;^hidden^<<SQL>> select tid,name from xcube_kennzahl where maskeninfo_id=${Maskennummer} and is_default=1^
21023^2.Ansicht in Zeilen^125^0^0^100^100^1^char^50^0^999^<<SQL>> select name,caption from xcube_dimconfig where maskeninfo_id=${Maskennummer} and is_secondrowdim=1 order by 1^hidden^1^
21024^Wohnort^38^0^0^140^80^1^char^30^0^12^<<SQL>> select tid,name,sortnr from sichten where art in ('SOS-Wohnort-Sicht') order by 3,2;^^^
21025^Alter^39^0^0^140^80^1^char^30^0^12^<<SQL>> select tid,name,sortnr from sichten where art in ('xcube_dim_alter') order by 3,2;^^^
21024^Wohnort^38^0^0^140^80^1^char^30^0^12^<<SQL>> select tid,name,sortnr from sichten where art in ('XCUBE-Wohnort-Sicht') order by 3,2;^^^
21025^Alter^39^0^0^140^80^1^char^30^0^12^<<SQL>> select tid,name,sortnr from sichten where art in ('XCUBE-Alter-Sicht') order by 3,2;^^^

83
src-modules/module/xcube/masken/21000_maskeninfo.unl

@ -3,23 +3,40 @@ @@ -3,23 +3,40 @@
<sqlvars>\
<sqlvar name="table_name">select table_name from xcube where maskeninfo_id=${Maskennummer}</sqlvar>\
<sqlvar name="aggrfunction">select aggrfunction from xcube_kennzahl where maskeninfo_id=${Maskennummer} and tid=<<Kennzahl>></sqlvar>\
<sqlvar name="aggrfunction_restriction">select nvl(restriction,''::char(1)) from xcube_kennzahl where maskeninfo_id=${Maskennummer} and tid=<<Kennzahl>></sqlvar>\
<sqlvar name="datatype">select nvl(datatype,'decimal(17,2)'::varchar(30)) from xcube_kennzahl where maskeninfo_id=${Maskennummer} and tid=<<Kennzahl>></sqlvar>\
--benoetigt falls Kennzahlen in Zeilen oder Splaten\
<sqlvar name="kennzahlen" type="hashsequence">select apnr,aggrfunction,nvl(restriction,''::char(1)) as restriction from xcube_kennzahl where maskeninfo_id=${Maskennummer}</sqlvar>\
<sqlvar name="aggrfunction_restriction">select nvl(restriction,''::char(1)) from xcube_kennzahl \
where maskeninfo_id=${Maskennummer} and tid=<<Kennzahl>>\
</sqlvar>\
<sqlvar name="datatype">select nvl(datatype,'decimal(17,2)'::varchar(30)) from xcube_kennzahl \
where maskeninfo_id=${Maskennummer} and tid=<<Kennzahl>></sqlvar>\
--benoetigt falls Kennzahlen in Zeilen oder Spalten\
<sqlvar name="kennzahlen" type="hashsequence">select apnr,aggrfunction,\
nvl(restriction,''::char(1)) as restriction \
from xcube_kennzahl where maskeninfo_id=${Maskennummer}</sqlvar>\
<sqlvar name="restriction" type="string"><![CDATA[<sximport>select restriction from xcube where maskeninfo_id=<<Maskennummer>></sximport>]]></sqlvar>\
<sqlvar name="coldef" type="hash"><![CDATA[select name,caption,foreignkey_tab,foreignkey_col,\
foreignkey_cap,nvl(foreignkey_cond,''::varchar(1)) as foreignkey_cond,\
<sqlvar name="coldef" type="hash"><![CDATA[select name,\
caption,\
foreignkey_tab,\
foreignkey_col,\
foreignkey_cap,\
nvl(foreignkey_cond,''::varchar(1))\
as foreignkey_cond,\
--nvl(C.specific_restriction,''::varchar(1)) as specific_restriction,\
sortfield,is_sicht,calc_gesamt,is_virtual,vcsql,nvl(attrib_nachbearbeitung,''::char(1)) as attrib_nachbearbeitung\
sortfield,\
is_sicht,\
calc_gesamt,\
is_virtual,\
vcsql,\
nvl(attrib_nachbearbeitung,''::char(1)) as attrib_nachbearbeitung\
from xcube_dimconfig where \
maskeninfo_id=${Maskennummer} \
and name=<<Ansicht in Ergebnisspalten>>]]>\
</sqlvar>\
<sqlvar name="nichtsicht_ergspalten" type='hashsequence'><![CDATA[\
<#if coldef.is_sicht=0>\
select distinct ${coldef.foreignkey_col} as apnr,${coldef.foreignkey_cap} as name,\
1::smallint as detailgesamtsort,${coldef.sortfield} as tmp_sortfield\
select distinct ${coldef.foreignkey_col} as apnr,\
${coldef.foreignkey_cap} as name,\
1::smallint as detailgesamtsort,\
${coldef.sortfield} as tmp_sortfield\
from ${coldef.foreignkey_tab} where \
1=1 \
<#if coldef.foreignkey_cond!=''> and ${coldef.foreignkey_cond} </#if>\
@ -32,9 +49,13 @@ and ${coldef.foreignkey_col}::varchar(255) in (select distinct ${coldef.name}::v @@ -32,9 +49,13 @@ and ${coldef.foreignkey_col}::varchar(255) in (select distinct ${coldef.name}::v
</#if>\
<#if coldef.calc_gesamt?number=1> \
union\
select 'gesamt','Gesamt',2::smallint as detailgesamtsort,null as tmp_sortfield from xdummy\
select 'gesamt','Gesamt',\
2::smallint as detailgesamtsort,\
null as tmp_sortfield from xdummy\
</#if>\
order by detailgesamtsort,tmp_sortfield,name;\
order by detailgesamtsort,\
tmp_sortfield,\
name;\
<#else>\
select 'Sichtspalten aktiv' from xdummy;\
</#if>\
@ -52,8 +73,11 @@ from xcube_dimconfig C where maskeninfo_id=${Maskennummer} and name=<<Ansicht in @@ -52,8 +73,11 @@ from xcube_dimconfig C where maskeninfo_id=${Maskennummer} and name=<<Ansicht in
--nur bei wenn Ergzeilen_def nicht vom Typ Sicht relevant\
<sqlvar name="nichtsicht_ergzeilen" type='hashsequence'><![CDATA[\
<#if rowdef.is_sicht=0>\
select 1::smallint as level, ${rowdef.foreignkey_col}::varchar(255) as key,--hier wird zur Vereinheitlichung mit Sichten Bezeichung "key" für eigentlichen Schluessel benoetigt\
${rowdef.foreignkey_cap} as name,${rowdef.sortfield} as tmp_sortfield from ${rowdef.foreignkey_tab}\
select 1::smallint as level, \
${rowdef.foreignkey_col}::varchar(255) as key,--hier wird zur Vereinheitlichung mit Sichten Bezeichung "key" für eigentlichen Schluessel benoetigt\
${rowdef.foreignkey_cap} as name,\
${rowdef.sortfield} as tmp_sortfield \
from ${rowdef.foreignkey_tab}\
where 1=1\
<#if rowdef.foreignkey_cond!=''> and ${rowdef.foreignkey_cond} </#if>\
--{rowdef.specific_restriction} \
@ -69,7 +93,12 @@ select 'nicht relevant' from xdummy;</#if>\ @@ -69,7 +93,12 @@ select 'nicht relevant' from xdummy;</#if>\
\
<sqlvar name="zweiteRowDef" type="hash"><![CDATA[\
<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">\
select name,caption,is_sicht,calc_gesamt,foreignkey_tab,foreignkey_col,foreignkey_cap,\
select name,caption,\
is_sicht,\
calc_gesamt,\
foreignkey_tab,\
foreignkey_col,\
foreignkey_cap,\
nvl(foreignkey_cond,''::varchar(1)) as foreignkey_cond,\
--nvl(C.specific_restriction,''::varchar(1)) as specific_restriction,\
C.sortfield\
@ -82,8 +111,11 @@ select 'keine zweite RowDef' from xdummy;\ @@ -82,8 +111,11 @@ select 'keine zweite RowDef' from xdummy;\
--nur bei wenn Ergzeilen_def nicht vom Typ Sicht relevant\
<sqlvar name="zweiteRow_nichtsicht_ergzeilen" type='hashsequence'><![CDATA[\
<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>"&&zweiteRowDef.is_sicht=0>\
select 1::smallint as level, ${zweiteRowDef.foreignkey_col}::varchar(255) as key,--hier wird zur Vereinheitlichung mit Sichten Bezeichung "key" für eigentlichen Schluessel benoetigt\
${zweiteRowDef.foreignkey_cap} as name,${zweiteRowDef.sortfield} as tmp_sortfield from ${zweiteRowDef.foreignkey_tab}\
select 1::smallint as level, \
${zweiteRowDef.foreignkey_col}::varchar(255) as key,--hier wird zur Vereinheitlichung mit Sichten Bezeichung "key" für eigentlichen Schluessel benoetigt\
${zweiteRowDef.foreignkey_cap} as name,\
${zweiteRowDef.sortfield} as tmp_sortfield \
from ${zweiteRowDef.foreignkey_tab}\
where 1=1\
<#if zweiteRowDef.foreignkey_cond!=''> and ${zweiteRowDef.foreignkey_cond} </#if>\
--{zweiteRowDef.specific_restriction} \
@ -318,7 +350,7 @@ update tmp_erg set name=replace(name,col1||' - ','');\ @@ -318,7 +350,7 @@ update tmp_erg set name=replace(name,col1||' - ','');\
\
\
select \
<#if rowdef.is_sicht&gt;0>ebene,col1,</#if>\
<#if rowdef.is_sicht&gt;0>ebene,</#if>\
name,\
<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">col2,</#if>\
<#assign i=0/>\
@ -340,19 +372,16 @@ XIL List\ @@ -340,19 +372,16 @@ XIL List\
min_heading_height=35\
<#if rowdef.is_sicht==1>\
Column CID=0 heading_text="Ebene" center_heading\
row_selectable heading_platform readonly\
width=10 text_size=8\
Column CID=20 heading_text="${.vars["Ansicht in ErgebniszeilenObject"].selectedItems[0].name}Nr" center_heading\
row_selectable heading_platform readonly\
width=10 text_size=10\
row_selectable heading_platform readonly explanation="Hierarchieebene"\
width=5 text_size=8\
</#if>\
Column CID=20 heading_text="${.vars["Ansicht in ErgebniszeilenObject"].selectedItems[0].name}" center_heading\
row_selectable heading_platform readonly\
width=10 text_size=10\
row_selectable heading_platform readonly explanation="Schlüssel: ${.vars["Ansicht in ErgebniszeilenObject"].selectedItems[0].name}Nr"\
width=30 text_size=30\
<#if "<<2.Ansicht in Zeilen>>"!=""&&"<<2.Ansicht in Zeilen>>"!="<<2.Ansicht in Zeilen>>">\
Column CID=20 heading_text="${.vars["2.Ansicht in ZeilenObject"].selectedItems[0].name}" center_heading\
row_selectable heading_platform readonly\
width=10 text_size=10\
width=20 text_size=10 explanation="${.vars["2.Ansicht in ZeilenObject"].selectedItems[0].name}"\
</#if>\
<#if coldef.is_sicht&gt;0>\
<#assign ergspalten=.vars[coldef.caption].elements/>\
@ -361,9 +390,7 @@ Column CID=20 heading_text="${.vars["2.Ansicht in ZeilenObject"].selectedItems[0 @@ -361,9 +390,7 @@ Column CID=20 heading_text="${.vars["2.Ansicht in ZeilenObject"].selectedItems[0
</#if>\
<#foreach spalte in ergspalten>\
Column CID=1 heading_text="${spalte.name}" center_heading\
row_selectable heading_platform readonly\
row_selectable heading_platform readonly explanation="Ausprägung ${spalte.name}"\
width=12\
</#foreach>\
\
\
@@@^Altersgruppe^Anzahl^Dynamische Darstellung von Studierendenzahlen^drop table tmp_erg;^^3^700^360^0^1^^

124
src-modules/module/xcube/schluesseltabellen/sichten_fuellen.sql

@ -0,0 +1,124 @@ @@ -0,0 +1,124 @@
--freemarker template
<#if SQLdialect='Postgres'>
select setval('sichten_tid_seq',(select max(tid) from sichten));
</#if>
<#assign systeminfoid="1000" />
<#assign sichten = [
{"name_intern":"xcube_dim_alter",
"name":"Alter (gruppiert in 5er-Schritten)",
"quelle":"<<SQL>> select name,apnr,parent,strukturstr from xcube_dims where id=''alter'' order by 2",
"art":"XCUBE-Alter-Sicht"},
{"name_intern":"xcube_dim_wohnort",
"name":"Wohnort nach Bundesländern",
"quelle":"<<SQL>> select ''Deutschland''::varchar(255) as druck , ''0'' as apnr, null::varchar(255) as parent from xdummy union select druck,apnr,''0'' from cifx where key=8 union select druck, '''' || val(astat), bund_apnr from cifx where key=11 order by 1",
"art":"XCUBE-Wohnort-Sicht"}
] />
--Ab hier braucht man nichts ändern:
CREATE temp TABLE tmp_sichten (
parent character(255),
systeminfoid integer DEFAULT 0 NOT NULL,
art character(40),
type integer ,
name_intern character(200),
name character(200),
beschreibung character(255),
sortnr integer DEFAULT 0 NOT NULL,
quelle character(255),
alt_hier_id character(150),
treecfgtable character(255),
treecfgid character(150),
label smallint DEFAULT 0 NOT NULL,
user_rechte smallint DEFAULT 1 NOT NULL,
rechtequelle character(255),
sesamkey character(100),
standbutton smallint DEFAULT 0 NOT NULL,
attribut1 character(255),
attribut2 character(255),
attribut3 integer,
attribut4 integer,
xmlmaxentries integer,
gueltig_seit date ,
gueltig_bis date,
aktiv smallint DEFAULT 1
);
<#assign sortnr=0 />
<#foreach sicht in sichten>
<#assign sortnr=sortnr+1 />
-- Sicht ${sicht.name}
INSERT INTO tmp_sichten(
systeminfoid ,
art ,
type ,
name_intern ,
name ,
sortnr ,
quelle ,
label ,
user_rechte ,
standbutton ,
gueltig_seit ,
gueltig_bis ,
aktiv
) select
${systeminfoid} ,
'${sicht.art}' ,
10 ,
'${sicht.name_intern}' ,
'${sicht.name}' ,
${sortnr} ,
'${sicht.quelle}',
0 ,
0 ,
0 ,
date_val('01.01.1900') ,
date_val('01.01.3000') ,
1 from xdummy;
</#foreach>
--Zur Sicherheit alle Quellen und Standbutton von Sichten
update sichten set quelle=(select T.quelle from tmp_sichten T
where T.name_intern=sichten.name_intern)
where name_intern in (select T2.name_intern from tmp_sichten T2)
;
update sichten set standbutton=(select T.standbutton from tmp_sichten T
where T.name_intern=sichten.name_intern)
where name_intern in (select T2.name_intern from tmp_sichten T2)
;
delete from tmp_sichten where name_intern in (select name_intern from sichten);
INSERT INTO sichten(
systeminfoid , art , type , name_intern , name ,
sortnr , quelle , label ,
user_rechte , standbutton ,
xmlmaxentries ,
gueltig_seit , gueltig_bis , aktiv)
select systeminfoid , art , type , name_intern , name ,
sortnr , quelle , label ,
user_rechte , standbutton ,
xmlmaxentries ,
gueltig_seit , gueltig_bis , aktiv
from tmp_sichten S;
--Rechte für Sichten geben
select 'Rechte für Sichten geben' from xdummy;
delete from sachgeb_sichtarten where sichtart in
(select distinct art from tmp_sichten);
insert into sachgeb_sichtarten
(
sachgebiete_id ,
sichtart
)
select distinct ${systeminfoid},art from tmp_sichten;
drop table tmp_sichten;

4
src-modules/module/xcube/schluesseltabellen/xcube_install.sql

@ -98,13 +98,13 @@ @@ -98,13 +98,13 @@
"sortfield":"tid"},
{"maskeninfo_id":21000,
"name":"semkfz",
"caption":"Wohnort",
"caption":"Wohnort (Semesterwohnsitz)",
"is_coldim":0,
"is_sicht":1 },
{"maskeninfo_id":21000,
"name":"alter",
"caption":"Alter",
"is_sicht":2},
"is_sicht":1},
<#-- Primärbuchungswürfel -->
{"maskeninfo_id":21500,

4
src-modules/module/xcube/xcube_sichten.sql

@ -1,4 +0,0 @@ @@ -1,4 +0,0 @@
--SQL-Sicht für die Dimension Alter
delete from sichten where art='xcube_dim_alter';
insert into sichten (art,type,name_intern,name,quelle,gueltig_seit,gueltig_bis,aktiv)
values ('xcube_dim_alter',10,'xdim_alter','Alter','<<SQL>> select name,apnr,parent,strukturstr from xcube_dims where id=''alter''','1900-01-01','3000-01-01',1);
Loading…
Cancel
Save