[open-ils-commits] r9213 - in trunk/Open-ILS: examples src/sql/Pg

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Apr 3 22:47:34 EDT 2008


Author: miker
Date: 2008-04-03 22:11:04 -0400 (Thu, 03 Apr 2008)
New Revision: 9213

Modified:
   trunk/Open-ILS/examples/fm_IDL.xml
   trunk/Open-ILS/src/sql/Pg/005.schema.actors.sql
   trunk/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
Log:
adding backend support for system-supplied "search groups" -- user search groups to come later

Modified: trunk/Open-ILS/examples/fm_IDL.xml
===================================================================
--- trunk/Open-ILS/examples/fm_IDL.xml	2008-04-04 00:43:23 UTC (rev 9212)
+++ trunk/Open-ILS/examples/fm_IDL.xml	2008-04-04 02:11:04 UTC (rev 9213)
@@ -1546,12 +1546,52 @@
         <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
             <actions>
                 <create permission="CREATE_RELEVANCE_ADJUSTMENT" global_required="true"/>
-                <retrieve/>
+                <retrieve permission="CREATE_RELEVANCE_ADJUSTMENT|UPDATE_RELEVANCE_ADJUSTMENT|DELETE_RELEVANCE_ADJUSTMENT" global_required="true"/>
                 <update permission="UPDATE_RELEVANCE_ADJUSTMENT" global_required="true"/>
                 <delete permission="DELETE_RELEVANCE_ADJUSTMENT" global_required="true"/>
             </actions>
         </permacrud>
 	</class>
+	<class id="lasso" controller="open-ils.cstore" oils_obj:fieldmapper="actor::org_lasso" oils_persist:tablename="actor.org_lasso">
+		<fields oils_persist:primary="id" oils_persist:sequence="actor.org_lasso_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" />
+			<field name="isdeleted" oils_obj:array_position="2" oils_persist:virtual="true" />
+			<field name="id" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="id" />
+			<field name="name" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="text"/>
+		</fields>
+		<links/>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <create permission="CREATE_LASSO" global_required="true"/>
+                <retrieve permission="CREATE_LASSO|UPDATE_LASSO|DELETE_LASSO" global_required="true"/>
+                <update permission="UPDATE_LASSO" global_required="true"/>
+                <delete permission="DELETE_LASSO" global_required="true"/>
+            </actions>
+        </permacrud>
+	</class>
+	<class id="lmap" controller="open-ils.cstore" oils_obj:fieldmapper="actor::org_lasso_map" oils_persist:tablename="actor.org_lasso_map">
+		<fields oils_persist:primary="id" oils_persist:sequence="actor.org_lasso_map_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" />
+			<field name="isdeleted" oils_obj:array_position="2" oils_persist:virtual="true" />
+			<field name="id" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="id" />
+			<field name="lasso" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="link"/>
+			<field name="org_unit" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="org_unit"/>
+		</fields>
+		<links>
+			<link field="lasso" reltype="has_a" key="id" map="" class="lasso"/>
+			<link field="org_unit" reltype="has_a" key="id" map="" class="aou"/>
+		</links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <create permission="CREATE_LASSO_MAP" global_required="true"/>
+                <retrieve permission="CREATE_LASSO_MAP|UPDATE_LASSO_MAP|DELETE_LASSO_MAP" global_required="true"/>
+                <update permission="UPDATE_LASSO_MAP" global_required="true"/>
+                <delete permission="DELETE_LASSO_MAP" global_required="true"/>
+            </actions>
+        </permacrud>
+	</class>
 	<class id="aoup" controller="open-ils.cstore" oils_obj:fieldmapper="actor::org_unit_proximity" oils_persist:tablename="actor.org_unit_proximity">
 		<fields oils_persist:primary="id" oils_persist:sequence="actor.org_unit_proximity_id_seq">
 			<field name="isnew" oils_obj:array_position="0" oils_persist:virtual="true" />

Modified: trunk/Open-ILS/src/sql/Pg/005.schema.actors.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/005.schema.actors.sql	2008-04-04 00:43:23 UTC (rev 9212)
+++ trunk/Open-ILS/src/sql/Pg/005.schema.actors.sql	2008-04-04 02:11:04 UTC (rev 9213)
@@ -4,7 +4,7 @@
 CREATE SCHEMA actor;
 COMMENT ON SCHEMA actor IS $$
 /*
- * Copyright (C) 2005  Georgia Public Library Service 
+ * Copyright (C) 2005-2008  Equinox Software, Inc. / Georgia Public Library Service 
  * Mike Rylander <mrylander at gmail.com>
  *
  * Schema: actor
@@ -66,7 +66,7 @@
 );
 COMMENT ON TABLE actor.usr IS $$
 /*
- * Copyright (C) 2005  Georgia Public Library Service 
+ * Copyright (C) 2005-2008  Equinox Software, Inc. / Georgia Public Library Service 
  * Mike Rylander <mrylander at gmail.com>
  *
  * User objects
@@ -150,7 +150,7 @@
 );
 COMMENT ON TABLE actor.usr_standing_penalty IS $$
 /*
- * Copyright (C) 2005  Georgia Public Library Service 
+ * Copyright (C) 2005-2008  Equinox Software, Inc. / Georgia Public Library Service 
  * Mike Rylander <mrylander at gmail.com>
  *
  * User standing penalties
@@ -180,7 +180,7 @@
 );
 COMMENT ON TABLE actor.usr_setting IS $$
 /*
- * Copyright (C) 2005  Georgia Public Library Service 
+ * Copyright (C) 2005-2008  Equinox Software, Inc. / Georgia Public Library Service 
  * Mike Rylander <mrylander at gmail.com>
  *
  * User settings
@@ -214,7 +214,7 @@
 );
 COMMENT ON TABLE actor.stat_cat IS $$
 /*
- * Copyright (C) 2005  Georgia Public Library Service 
+ * Copyright (C) 2005-2008  Equinox Software, Inc. / Georgia Public Library Service 
  * Mike Rylander <mrylander at gmail.com>
  *
  * User Statistical Catagories
@@ -246,7 +246,7 @@
 );
 COMMENT ON TABLE actor.stat_cat_entry IS $$
 /*
- * Copyright (C) 2005  Georgia Public Library Service 
+ * Copyright (C) 2005-2008  Equinox Software, Inc. / Georgia Public Library Service 
  * Mike Rylander <mrylander at gmail.com>
  *
  * User Statistical Catagory Entries
@@ -280,7 +280,7 @@
 );
 COMMENT ON TABLE actor.stat_cat_entry_usr_map IS $$
 /*
- * Copyright (C) 2005  Georgia Public Library Service 
+ * Copyright (C) 2005-2008  Equinox Software, Inc. / Georgia Public Library Service 
  * Mike Rylander <mrylander at gmail.com>
  *
  * Statistical Catagory Entry to User map
@@ -312,7 +312,7 @@
 );
 COMMENT ON TABLE actor.card IS $$
 /*
- * Copyright (C) 2005  Georgia Public Library Service 
+ * Copyright (C) 2005-2008  Equinox Software, Inc. / Georgia Public Library Service 
  * Mike Rylander <mrylander at gmail.com>
  *
  * Library Cards
@@ -371,6 +371,19 @@
 CREATE INDEX actor_org_unit_mailing_address_idx ON actor.org_unit (mailing_address);
 CREATE INDEX actor_org_unit_holds_address_idx ON actor.org_unit (holds_address);
 
+CREATE TABLE actor.org_lasso (
+    id      SERIAL  PRIMARY KEY,
+    name   	TEXT    UNIQUE
+);
+
+CREATE TABLE actor.org_lasso_map (
+    id          SERIAL  PRIMARY KEY,
+    lasso       INT     NOT NULL REFERENCES actor.org_lasso (id) ON DELETE CASCADE,
+    org_unit    INT     NOT NULL REFERENCES actor.org_unit (id) ON DELETE CASCADE
+);
+CREATE INDEX ou_lasso_lasso_idx ON actor.org_lasso_map (lasso);
+CREATE INDEX ou_lasso_org_unit_idx ON actor.org_lasso_map (org_unit);
+
 CREATE TABLE actor.org_unit_proximity (
 	id		BIGSERIAL	PRIMARY KEY,
 	from_org	INT,
@@ -431,7 +444,7 @@
 );
 COMMENT ON TABLE actor.org_unit_setting IS $$
 /*
- * Copyright (C) 2005  Georgia Public Library Service 
+ * Copyright (C) 2005-2008  Equinox Software, Inc. / Georgia Public Library Service 
  * Mike Rylander <mrylander at gmail.com>
  *
  * Org Unit settings

Modified: trunk/Open-ILS/src/sql/Pg/300.schema.staged_search.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/300.schema.staged_search.sql	2008-04-04 00:43:23 UTC (rev 9212)
+++ trunk/Open-ILS/src/sql/Pg/300.schema.staged_search.sql	2008-04-04 02:11:04 UTC (rev 9213)
@@ -337,10 +337,16 @@
                         ' GROUP BY 1 ORDER BY 4' || CASE WHEN sort_desc THEN ' DESC' ELSE ' ASC' END || ';';
     --RAISE NOTICE 'Base Query:  %', core_rel_query;
 
-    IF param_depth IS NOT NULL THEN
-        SELECT array_accum(distinct id) INTO search_org_list FROM actor.org_unit_descendants( param_search_ou, param_depth );
-    ELSE
-        SELECT array_accum(distinct id) INTO search_org_list FROM actor.org_unit_descendants( param_search_ou );
+    IF param_search_ou > 0 THEN
+        IF param_depth IS NOT NULL THEN
+            SELECT array_accum(distinct id) INTO search_org_list FROM actor.org_unit_descendants( param_search_ou, param_depth );
+        ELSE
+            SELECT array_accum(distinct id) INTO search_org_list FROM actor.org_unit_descendants( param_search_ou );
+        END IF;
+    ELSIF param_search_ou < 0 THEN
+        SELECT array_accum(distinct org_unit) INTO search_org_list FROM actor.org_lasso_map WHERE lasso = -param_search_ou;
+    ELSIF param_search_ou = 0 THEN
+        -- reserved for user lassos (ou_buckets/type='lasso') with ID passed in depth ... hack? sure.
     END IF;
 
     OPEN core_cursor FOR EXECUTE core_rel_query;



More information about the open-ils-commits mailing list