[open-ils-commits] r12091 - in trunk/Open-ILS: examples src/c-apps src/perlmods/OpenILS/Utils web/js/dojo/fieldmapper (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Feb 6 10:05:43 EST 2009
Author: miker
Date: 2009-02-06 10:05:41 -0500 (Fri, 06 Feb 2009)
New Revision: 12091
Modified:
trunk/Open-ILS/examples/fm_IDL.xml
trunk/Open-ILS/src/c-apps/dump_idl.c
trunk/Open-ILS/src/c-apps/oils_idl-core.c
trunk/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm
trunk/Open-ILS/web/js/dojo/fieldmapper/IDL.js
Log:
teaching everyone how to note the pkey delete restriction policy for specific classes
Modified: trunk/Open-ILS/examples/fm_IDL.xml
===================================================================
--- trunk/Open-ILS/examples/fm_IDL.xml 2009-02-06 14:28:30 UTC (rev 12090)
+++ trunk/Open-ILS/examples/fm_IDL.xml 2009-02-06 15:05:41 UTC (rev 12091)
@@ -1964,7 +1964,7 @@
</actions>
</permacrud>
</class>
- <class id="ccs" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::copy_status" oils_persist:tablename="config.copy_status">
+ <class id="ccs" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::copy_status" oils_persist:tablename="config.copy_status" oils_persist:restrict_primary="100">
<fields oils_persist:primary="id" oils_persist:sequence="config.copy_status_id_seq">
<field name="isnew" oils_obj:array_position="0" oils_persist:virtual="true" />
<field name="ischanged" oils_obj:array_position="1" oils_persist:virtual="true" />
@@ -1984,7 +1984,7 @@
</actions>
</permacrud>
</class>
- <class id="ausp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="actor::user_standing_penalty" oils_persist:tablename="actor.usr_standing_penalty">
+ <class id="ausp" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="actor::user_standing_penalty" oils_persist:tablename="actor.usr_standing_penalty" oils_persist:restrict_primary="100">
<fields oils_persist:primary="id" oils_persist:sequence="actor.usr_standing_penalty_id_seq">
<field name="isnew" oils_obj:array_position="0" oils_persist:virtual="true" />
<field name="ischanged" oils_obj:array_position="1" oils_persist:virtual="true" />
@@ -3641,7 +3641,7 @@
</links>
</class>
- <class id="ahrcc" controller="open-ils.cstore open-ils.reporter-store open-ils.pcrud" oils_obj:fieldmapper="action::hold_request_cancel_cause" oils_persist:tablename="action.hold_request_cancel_cause">
+ <class id="ahrcc" controller="open-ils.cstore open-ils.reporter-store open-ils.pcrud" oils_obj:fieldmapper="action::hold_request_cancel_cause" oils_persist:tablename="action.hold_request_cancel_cause" oils_persist:restrict_primary="100">
<fields oils_persist:primary="id" oils_persist:sequence="action.hold_request_cancel_cause_id_seq">
<field name="isnew" oils_obj:array_position="0" oils_persist:virtual="true" />
<field name="ischanged" oils_obj:array_position="1" oils_persist:virtual="true" />
@@ -3776,7 +3776,7 @@
</actions>
</permacrud>
</class>
- <class id="cbt" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::billing_type" oils_persist:tablename="config.billing_type">
+ <class id="cbt" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::billing_type" oils_persist:tablename="config.billing_type" oils_persist:restrict_primary="100">
<fields oils_persist:primary="id" oils_persist:sequence="config.billing_type_id_seq">
<field name="isnew" oils_obj:array_position="0" oils_persist:virtual="true" />
<field name="ischanged" oils_obj:array_position="1" oils_persist:virtual="true" />
Modified: trunk/Open-ILS/src/c-apps/dump_idl.c
===================================================================
--- trunk/Open-ILS/src/c-apps/dump_idl.c 2009-02-06 14:28:30 UTC (rev 12090)
+++ trunk/Open-ILS/src/c-apps/dump_idl.c 2009-02-06 15:05:41 UTC (rev 12091)
@@ -141,6 +141,8 @@
printf( "%s%s: %s\n", indent, attr_name, (char*) class_attr );
else if( !strcmp( attr_name, "tablename" ) )
printf( "%s%s: %s\n", indent, attr_name, (char*) class_attr );
+ else if( !strcmp( attr_name, "restrict_primary" ) )
+ printf( "%s%s: %s\n", indent, attr_name, (char*) class_attr );
else if( !strcmp( attr_name, "virtual" ) )
printf( "%s%s: %s\n", indent, attr_name, (char*) class_attr );
else if( !strcmp( attr_name, "controller" ) )
Modified: trunk/Open-ILS/src/c-apps/oils_idl-core.c
===================================================================
--- trunk/Open-ILS/src/c-apps/oils_idl-core.c 2009-02-06 14:28:30 UTC (rev 12090)
+++ trunk/Open-ILS/src/c-apps/oils_idl-core.c 2009-02-06 15:05:41 UTC (rev 12091)
@@ -66,6 +66,15 @@
);
}
+ if ((prop_str = (char*)xmlGetNsProp(kid, BAD_CAST "restrict_primary", BAD_CAST PERSIST_NS))) {
+ osrfLogDebug(OSRF_LOG_MARK, "Delete restriction policy set at '%s' for pkey of class %s", prop_str, current_class_name );
+ osrfHashSet(
+ class_def_hash,
+ strdup( prop_str ),
+ "restrict_primary"
+ );
+ }
+
if ((prop_str = (char*)xmlGetNsProp(kid, BAD_CAST "virtual", BAD_CAST PERSIST_NS))) {
osrfHashSet(
class_def_hash,
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm 2009-02-06 14:28:30 UTC (rev 12090)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm 2009-02-06 15:05:41 UTC (rev 12091)
@@ -59,6 +59,7 @@
$$fieldmap{$n}{hint} = $c;
$$fieldmap{$n}{virtual} = ($idl->{$c}{'oils_persist:virtual'} && $idl->{$c}{'oils_persist:virtual'} eq 'true') ? 1 : 0;
$$fieldmap{$n}{table} = $idl->{$c}{'oils_persist:tablename'};
+ $$fieldmap{$n}{restrict_primary} = $idl->{$c}{'oils_persist:restrict_primary'};
$$fieldmap{$n}{sequence} = $idl->{$c}{fields}{'oils_persist:sequence'};
$$fieldmap{$n}{identity} = $idl->{$c}{fields}{'oils_persist:primary'};
@@ -176,6 +177,11 @@
return $$fieldmap{$self->class_name}{identity};
}
+sub RestrictPrimary {
+ my $self = shift;
+ return $$fieldmap{$self->class_name}{restrict_primary};
+}
+
sub Sequence {
my $self = shift;
return $$fieldmap{$self->class_name}{sequence};
Modified: trunk/Open-ILS/web/js/dojo/fieldmapper/IDL.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/fieldmapper/IDL.js 2009-02-06 14:28:30 UTC (rev 12090)
+++ trunk/Open-ILS/web/js/dojo/fieldmapper/IDL.js 2009-02-06 15:05:41 UTC (rev 12091)
@@ -48,6 +48,7 @@
//table : node.getAttributeNS(this.NS_PERSIST, 'tablename'),
//core : node.getAttributeNS(this.NS_REPORTS, 'core'),
label : node.getAttributeNS(this.NS_REPORTS, 'label'),
+ restrict_primary : node.getAttributeNS(this.NS_PERSIST, 'restrict_primary'),
virtual : (node.getAttributeNS(this.NS_PERSIST, 'virtual') == 'true'),
pkey : fields.getAttributeNS(this.NS_PERSIST, 'primary')
};
More information about the open-ils-commits
mailing list