codify bucket types
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 3 Dec 2008 21:39:47 +0000 (21:39 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 3 Dec 2008 21:39:47 +0000 (21:39 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@11393 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/fm_IDL.xml
Open-ILS/src/sql/Pg/070.schema.container.sql

index fe80332..21185a3 100644 (file)
@@ -616,6 +616,82 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
         </permacrud>
        </class>
 
+       <class id="ccpbt" controller="open-ils.cstore" oils_obj:fieldmapper="container::copy_bucket_type" oils_persist:tablename="container.copy_bucket_type" reporter:label="Copy Bucket Type" oils_persist:field_safe="true">
+               <fields oils_persist:primary="code">
+                       <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 reporter:label="Code" name="code" oils_obj:array_position="3" oils_persist:virtual="false" reporter:selector="name" reporter:datatype="id"/>
+                       <field reporter:label="Label" name="label" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="text" oils_persist:i18n="true"/>
+               </fields>
+               <links/>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <create permission="CREATE_COPY_BTYPE" global_required="true"/>
+                <retrieve permission="CREATE_COPY_BTYPE|UPDATE_COPY_BTYPE|DELETE_COPY_BTYPE" global_required="true"/>
+                <update permission="UPDATE_COPY_BTYPE" global_required="true"/>
+                <delete permission="DELETE_COPY_BTYPE" global_required="true"/>
+            </actions>
+        </permacrud>
+       </class>
+
+       <class id="ccnbt" controller="open-ils.cstore" oils_obj:fieldmapper="container::call_number_bucket_type" oils_persist:tablename="container.call_number_bucket_type" reporter:label="Call Number Bucket Type" oils_persist:field_safe="true">
+               <fields oils_persist:primary="code">
+                       <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 reporter:label="Code" name="code" oils_obj:array_position="3" oils_persist:virtual="false" reporter:selector="name" reporter:datatype="id"/>
+                       <field reporter:label="Label" name="label" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="text" oils_persist:i18n="true"/>
+               </fields>
+               <links/>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <create permission="CREATE_CN_BTYPE" global_required="true"/>
+                <retrieve permission="CREATE_CN_BTYPE|UPDATE_CN_BTYPE|DELETE_CN_BTYPE" global_required="true"/>
+                <update permission="UPDATE_CN_BTYPE" global_required="true"/>
+                <delete permission="DELETE_CN_BTYPE" global_required="true"/>
+            </actions>
+        </permacrud>
+       </class>
+
+       <class id="cbrebt" controller="open-ils.cstore" oils_obj:fieldmapper="container::biblio_record_entry_bucket_type" oils_persist:tablename="container.biblio_record_entry_bucket_type" reporter:label="Bibliographic Record Bucket Type" oils_persist:field_safe="true">
+               <fields oils_persist:primary="code">
+                       <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 reporter:label="Code" name="code" oils_obj:array_position="3" oils_persist:virtual="false" reporter:selector="name" reporter:datatype="id"/>
+                       <field reporter:label="Label" name="label" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="text" oils_persist:i18n="true"/>
+               </fields>
+               <links/>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <create permission="CREATE_BIB_BTYPE" global_required="true"/>
+                <retrieve permission="CREATE_BIB_BTYPE|UPDATE_BIB_BTYPE|DELETE_BIB_BTYPE" global_required="true"/>
+                <update permission="UPDATE_BIB_BTYPE" global_required="true"/>
+                <delete permission="DELETE_BIB_BTYPE" global_required="true"/>
+            </actions>
+        </permacrud>
+       </class>
+
+       <class id="cubt" controller="open-ils.cstore" oils_obj:fieldmapper="container::user_bucket_type" oils_persist:tablename="container.user_bucket_type" reporter:label="User Bucket Type" oils_persist:field_safe="true">
+               <fields oils_persist:primary="code">
+                       <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 reporter:label="Code" name="code" oils_obj:array_position="3" oils_persist:virtual="false" reporter:selector="name" reporter:datatype="id"/>
+                       <field reporter:label="Label" name="label" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="text" oils_persist:i18n="true"/>
+               </fields>
+               <links/>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <create permission="CREATE_USER_BTYPE" global_required="true"/>
+                <retrieve permission="CREATE_USER_BTYPE|UPDATE_USER_BTYPE|DELETE_USER_BTYPE" global_required="true"/>
+                <update permission="UPDATE_USER_BTYPE" global_required="true"/>
+                <delete permission="DELETE_USER_BTYPE" global_required="true"/>
+            </actions>
+        </permacrud>
+       </class>
+
        <class id="cvrfm" controller="open-ils.cstore" oils_obj:fieldmapper="config::videorecording_format_map" oils_persist:tablename="config.videorecording_format_map" reporter:label="Videorecording Format" oils_persist:field_safe="true">
                <fields oils_persist:primary="code">
                        <field name="isnew" oils_obj:array_position="0" oils_persist:virtual="true" />
index 983c447..e408c51 100644 (file)
@@ -20,6 +20,13 @@ DROP SCHEMA container CASCADE;
 BEGIN;
 CREATE SCHEMA container;
 
+CREATE TABLE container.copy_bucket_type (
+       code    TEXT    PRIMARY KEY,
+       label   TEXT    NOT NULL UNIQUE
+);
+INSERT INTO container.copy_bucket_type (code,label) VALUES ('misc','Miscellaneous');
+INSERT INTO container.copy_bucket_type (code,label) VALUES ('staff_client','General Staff Client container');
+
 CREATE TABLE container.copy_bucket (
        id              SERIAL                          PRIMARY KEY,
        owner           INT                             NOT NULL
@@ -29,7 +36,7 @@ CREATE TABLE container.copy_bucket (
                                                                DEFERRABLE
                                                                INITIALLY DEFERRED,
        name            TEXT                            NOT NULL,
-       btype           TEXT                            NOT NULL DEFAULT 'misc',
+       btype           TEXT                            NOT NULL DEFAULT 'misc' REFERENCES container.copy_bucket_type (code),
        pub             BOOL                            NOT NULL DEFAULT FALSE,
        create_time     TIMESTAMP WITH TIME ZONE        NOT NULL DEFAULT NOW(),
        CONSTRAINT cb_name_once_per_owner UNIQUE (owner,name,btype)
@@ -55,6 +62,12 @@ CREATE TABLE container.copy_bucket_item (
 
 
 
+CREATE TABLE container.call_number_bucket_type (
+       code    TEXT    PRIMARY KEY,
+       label   TEXT    NOT NULL UNIQUE
+);
+INSERT INTO container.call_number_bucket_type (code,label) VALUES ('misc','Miscellaneous');
+
 CREATE TABLE container.call_number_bucket (
        id      SERIAL  PRIMARY KEY,
        owner   INT     NOT NULL
@@ -64,7 +77,7 @@ CREATE TABLE container.call_number_bucket (
                                DEFERRABLE
                                INITIALLY DEFERRED,
        name    TEXT    NOT NULL,
-       btype   TEXT    NOT NULL DEFAULT 'misc',
+       btype   TEXT    NOT NULL DEFAULT 'misc' REFERENCES container.call_number_bucket_type (code),
        pub     BOOL    NOT NULL DEFAULT FALSE,
        create_time     TIMESTAMP WITH TIME ZONE        NOT NULL DEFAULT NOW(),
        CONSTRAINT cnb_name_once_per_owner UNIQUE (owner,name,btype)
@@ -89,6 +102,14 @@ CREATE TABLE container.call_number_bucket_item (
 
 
 
+CREATE TABLE container.biblio_record_entry_bucket_type (
+       code    TEXT    PRIMARY KEY,
+       label   TEXT    NOT NULL UNIQUE
+);
+INSERT INTO container.biblio_record_entry_bucket_type (code,label) VALUES ('misc','Miscellaneous');
+INSERT INTO container.biblio_record_entry_bucket_type (code,label) VALUES ('staff_client','General Staff Client container');
+INSERT INTO container.biblio_record_entry_bucket_type (code,label) VALUES ('bookbag','Book Bag');
+
 
 CREATE TABLE container.biblio_record_entry_bucket (
        id      SERIAL  PRIMARY KEY,
@@ -99,7 +120,7 @@ CREATE TABLE container.biblio_record_entry_bucket (
                                DEFERRABLE
                                INITIALLY DEFERRED,
        name    TEXT    NOT NULL,
-       btype   TEXT    NOT NULL DEFAULT 'misc',
+       btype   TEXT    NOT NULL DEFAULT 'misc' REFERENCES container.biblio_record_entry_bucket_type (code),
        pub     BOOL    NOT NULL DEFAULT FALSE,
        create_time     TIMESTAMP WITH TIME ZONE        NOT NULL DEFAULT NOW(),
        CONSTRAINT breb_name_once_per_owner UNIQUE (owner,name,btype)
@@ -124,6 +145,14 @@ CREATE TABLE container.biblio_record_entry_bucket_item (
 
 
 
+CREATE TABLE container.user_bucket_type (
+       code    TEXT    PRIMARY KEY,
+       label   TEXT    NOT NULL UNIQUE
+);
+INSERT INTO container.user_bucket_type (code,label) VALUES ('misc','Miscellaneous');
+INSERT INTO container.user_bucket_type (code,label) VALUES ('folks','Friends');
+INSERT INTO container.user_bucket_type (code,label) VALUES ('folks:pub_book_bags.view','List Published Book Bags');
+INSERT INTO container.user_bucket_type (code,label) VALUES ('folks:pub_book_bags.add','Add to Published Book Bags');
 
 CREATE TABLE container.user_bucket (
        id      SERIAL  PRIMARY KEY,
@@ -134,7 +163,7 @@ CREATE TABLE container.user_bucket (
                                DEFERRABLE
                                INITIALLY DEFERRED,
        name    TEXT    NOT NULL,
-       btype   TEXT    NOT NULL DEFAULT 'misc',
+       btype   TEXT    NOT NULL DEFAULT 'misc' REFERENCES container.user_bucket_type (code),
        pub     BOOL    NOT NULL DEFAULT FALSE,
        create_time     TIMESTAMP WITH TIME ZONE        NOT NULL DEFAULT NOW(),
        CONSTRAINT ub_name_once_per_owner UNIQUE (owner,name,btype)