Adding tables for browse axis mapping
authorMike Rylander <mrylander@gmail.com>
Wed, 11 May 2011 21:06:45 +0000 (17:06 -0400)
committerMike Rylander <mrylander@gmail.com>
Wed, 11 May 2011 21:06:45 +0000 (17:06 -0400)
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/sql/Pg/011.schema.authority.sql
Open-ILS/src/sql/Pg/950.data.seed-values.sql

index 412ecde..8ac3e94 100644 (file)
@@ -1721,6 +1721,48 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                </permacrud>
        </class>
 
+       <class id="aba" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="authority::browse_axis" oils_persist:tablename="authority.browse_axis" reporter:label="Authority Browse Axis">
+               <fields oils_persist:primary="code">
+                       <field reporter:label="Code" name="code" reporter:datatype="id" reporter:selector="name"/>
+                       <field reporter:label="Name" name="name" reporter:datatype="text" oils_persist:i18n="true" oils_obj:required="true"/>
+                       <field reporter:label="Description" name="description" reporter:datatype="text"/>
+                       <field reporter:label="Authority Fields" name="fields" reporter:datatype="link" oils_persist:virtual="true"/>
+                       <field reporter:label="Authority Field Maps" name="maps" reporter:datatype="link" oils_persist:virtual="true"/>
+               </fields>
+               <links>
+                       <link field="fields" reltype="has_many" key="axis" map="field" class="abaafm"/>
+                       <link field="maps" reltype="has_many" key="axis" map="" class="abaafm"/>
+               </links>
+               <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+                       <actions>
+                               <create permission="CREATE_AUTHORITY_CONTROLSET" global_required="true"/>
+                               <retrieve/>
+                               <update permission="UPDATE_AUTHORITY_CONTROLSET" global_required="true"/>
+                               <delete permission="UPDATE_AUTHORITY_CONTROLSET" global_required="true"/>
+                       </actions>
+               </permacrud>
+       </class>
+
+    <class id="abaafm" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="authority::browse_axis_authority_field_map" oils_persist:tablename="authority.browse_axis_authority_field_map" reporter:label="Authority Browse Axis Field Map">
+        <fields oils_persist:primary="id" oils_persist:sequence="authority.browse_axis_authority_field_map_id_seq">
+            <field reporter:label="Axis Authority Field Map ID" name="id" reporter:datatype="id"/>
+            <field reporter:label="Authority Field" name="authority_field" oils_obj:required="true" reporter:datatype="link"/>
+            <field reporter:label="Axis" name="axis" reporter:datatype="link" oils_obj:required="true"/>
+        </fields>
+        <links>
+            <link field="field" reltype="has_a" key="id" map="" class="acsaf"/>
+            <link field="axis" reltype="has_a" key="code" map="" class="aba"/>
+        </links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <create permission="CREATE_AUTHORITY_CONTROLSET" global_required="true"/>
+                <retrieve/>
+                <update permission="UPDATE_AUTHORITY_CONTROLSET" global_required="true"/>
+                <delete permission="UPDATE_AUTHORITY_CONTROLSET" global_required="true"/>
+            </actions>
+        </permacrud>
+    </class>
+
        <class id="are" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="authority::record_entry" oils_persist:tablename="authority.record_entry" reporter:label="Authority Record Entry">
                <fields oils_persist:primary="id" oils_persist:sequence="authority.record_entry_id_seq">
                        <field name="active" reporter:datatype="bool"/>
index 68cb349..3aac234 100644 (file)
@@ -51,6 +51,18 @@ CREATE TABLE authority.thesaurus (
     description TEXT                     -- i18n
 );
 
+CREATE TABLE authority.browse_axis (
+    code        TEXT    PRIMARY KEY,
+    name        TEXT    UNIQUE NOT NULL, -- i18n
+    description TEXT
+);
+
+CREATE TABLE authority.browse_axis_authority_field_map (
+    id          SERIAL  PRIMARY KEY,
+    axis        TEXT    NOT NULL REFERENCES authority.browse_axis (code) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+    field       INT     NOT NULL REFERENCES authority.control_set_authority_field (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
+);
+
 CREATE TABLE authority.record_entry (
     id              BIGSERIAL    PRIMARY KEY,
     create_date     TIMESTAMP WITH TIME ZONE    NOT NULL DEFAULT now(),
index 3c205c1..046e688 100644 (file)
@@ -8042,6 +8042,22 @@ INSERT INTO authority.control_set_authority_field (id, control_set, main_entry,
     (71, 1, 11, '485', 'ivwxyz4', oils_i18n_gettext('71','See Also Tracing -- Form Subdivision','acsaf','name')),
     (72, 1, 12, '448', 'aivwxyz4', oils_i18n_gettext('72','See Also Tracing -- Chronological Term','acsaf','name'));
 
+INSERT INTO authority.browse_axis (code,name,description) VALUES
+    ('title','Title','Title axis'),
+    ('author','Author','Author axis'),
+    ('subject','Subject','Subject axis'),
+    ('topic','Topic','Topic Subject axis');
+
+INSERT INTO authority.browse_axis_authority_field_map (axis,field) VALUES
+    ('author',  1 ),
+    ('author',  2 ),
+    ('author',  3 ),
+    ('title',   4 ),
+    ('topic',   5 ),
+    ('subject', 5 ),
+    ('subject', 6 ),
+    ('subject', 7 ),
+    ('subject', 12);
 
 INSERT INTO authority.control_set_bib_field (tag, authority_field) VALUES
     SELECT '100', id FROM authority.control_set_authority_field WHERE tag IN ('100')