[open-ils-commits] r15322 - in trunk/Open-ILS: examples src/sql/Pg src/sql/Pg/upgrade (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Jan 15 10:57:52 EST 2010
Author: erickson
Date: 2010-01-15 10:57:49 -0500 (Fri, 15 Jan 2010)
New Revision: 15322
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0133.schema.config_accounts_and_acq_edi.sql
Modified:
trunk/Open-ILS/examples/fm_IDL.xml
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/200.schema.acq.sql
trunk/Open-ILS/src/sql/Pg/800.fkeys.sql
Log:
Patch from Joe Atzberger, with some IDL additions, to add a new generic remote_account table for managing ftp/scp/etc logins and a subclass table specific to ACQ providers, initially for EDI retrieval and delivery.
Modified: trunk/Open-ILS/examples/fm_IDL.xml
===================================================================
--- trunk/Open-ILS/examples/fm_IDL.xml 2010-01-14 16:55:27 UTC (rev 15321)
+++ trunk/Open-ILS/examples/fm_IDL.xml 2010-01-15 15:57:49 UTC (rev 15322)
@@ -527,6 +527,31 @@
</permacrud>
</class>
+ <class id="cracct" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::remote_account" oils_persist:tablename="config.remote_account" reporter:label="Remote (3rd party) Account">
+ <fields oils_persist:primary="id" oils_persist:sequence="config.remote_account_id_seq">
+ <field name="id" reporter:datatype="id" reporter:label="ID"/>
+ <field name="label" reporter:datatype="text" reporter:label="Label"/>
+ <field name="host" reporter:datatype="text" reporter:label="Host"/>
+ <field name="username" reporter:datatype="text" reporter:label="Username"/>
+ <field name="password" reporter:datatype="text" reporter:label="Password"/>
+ <field name="account" reporter:datatype="text" reporter:label="Account"/>
+ <field name="path" reporter:datatype="text" reporter:label="Path"/>
+ <field name="owner" reporter:datatype="link" reporter:label="Owner"/>
+ <field name="last_activity" reporter:datatype="timestamp" reporter:label="Last Activity"/>
+ </fields>
+ <links>
+ <link field="owner" reltype="has_a" key="id" map="" class="aou"/>
+ </links>
+ <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+ <actions>
+ <create permission="ADMIN_CONFIG_REMOTE_ACCOUNT" context_field="owner"/>
+ <retrieve permission="ADMIN_CONFIG_REMOTE_ACCOUNT" context_field="owner"/>
+ <update permission="ADMIN_CONFIG_REMOTE_ACCOUNT" context_field="owner"/>
+ <delete permission="ADMIN_CONFIG_REMOTE_ACCOUNT" context_field="owner"/>
+ </actions>
+ </permacrud>
+ </class>
+
<class id="czs" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::z3950_source" oils_persist:tablename="config.z3950_source" reporter:label="Z39.50 Source">
<fields oils_persist:primary="name">
<field reporter:label="Z39.50 Source" name="name" reporter:datatype="id"/>
@@ -4311,11 +4336,13 @@
<field reporter:label="Holdings Tag" name="holding_tag" reporter:datatype="text" />
<field reporter:label="Addresses" name="addresses" oils_persist:virtual="true" reporter:datatype="link" />
<field reporter:label="SAN" name="san" reporter:datatype="text" />
+ <field reporter:label="EDI Default" name="edi_default" reporter:datatype="link" />
</fields>
<links>
<link field="currency_type" reltype="has_a" key="code" map="" class="acqct"/>
<link field="owner" reltype="has_a" key="id" map="" class="aou"/>
<link field="addresses" reltype="has_many" map="" key="provider" class="acqpa"/>
+ <link field="edi_default" reltype="has_a" map="" key="id" class="acqedi"/>
</links>
<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
<actions>
@@ -5022,6 +5049,41 @@
<links/>
</class>
+ <class id="acqedi" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="acq::edi_account" oils_persist:tablename="acq.edi_account" reporter:label="EDI Account">
+ <fields oils_persist:primary="id" oils_persist:sequence="config.remote_account_id_seq"><!-- edi_account inherits from config.remote_account, hence the seq -->
+ <field name="id" reporter:datatype="id" reporter:label="EDI Account ID"/>
+ <field name="label" reporter:datatype="text" reporter:label="Label"/>
+ <field name="host" reporter:datatype="text" reporter:label="Host"/>
+ <field name="username" reporter:datatype="text" reporter:label="Username"/>
+ <field name="password" reporter:datatype="text" reporter:label="Password"/>
+ <field name="account" reporter:datatype="text" reporter:label="Account"/>
+ <field name="path" reporter:datatype="text" reporter:label="Path"/>
+ <field name="owner" reporter:datatype="link" reporter:label="Owner"/>
+ <field name="last_activity" reporter:datatype="timestamp" reporter:label="Last Activity"/>
+ <field name="provider" reporter:datatype="link" reporter:label="Provider"/>
+ <field name="in_dir" reporter:datatype="text" reporter:label="Incoming Directory"/>
+ </fields>
+ <links>
+ <link field="provider" reltype="has_a" key="id" map="" class="rof"/>
+ </links>
+ <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+ <actions>
+ <create permission="ADMIN_PROVIDER">
+ <context link="provider" field="owner"/>
+ </create>
+ <retrieve permission="ADMIN_PROVIDER">
+ <context link="provider" field="owner"/>
+ </retrieve>
+ <update permission="ADMIN_PROVIDER">
+ <context link="provider" field="owner"/>
+ </update>
+ <delete permission="ADMIN_PROVIDER">
+ <context link="provider" field="owner"/>
+ </delete>
+ </actions>
+ </permacrud>
+ </class>
+
<class id="rof" controller="open-ils.reporter-store" oils_obj:fieldmapper="reporter::output_folder" oils_persist:tablename="reporter.output_folder" reporter:label="Output Folder">
<fields oils_persist:primary="id" oils_persist:sequence="reporter.output_folder_id_seq">
<field name="id" reporter:datatype="id" />
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-01-14 16:55:27 UTC (rev 15321)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-01-15 15:57:49 UTC (rev 15322)
@@ -449,6 +449,19 @@
*/
$$;
+
+CREATE TABLE config.remote_account (
+ id SERIAL PRIMARY KEY,
+ label TEXT NOT NULL,
+ host TEXT NOT NULL, -- name or IP, :port optional
+ username TEXT, -- optional, since we could default to $USER
+ password TEXT, -- optional, since we could use SSH keys, or anonymous login.
+ account TEXT, -- aka profile or FTP "account" command
+ path TEXT, -- aka directory
+ owner INT NOT NULL, -- REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED,
+ last_activity TIMESTAMP WITH TIME ZONE
+);
+
CREATE TABLE config.audience_map (
code TEXT PRIMARY KEY,
value TEXT NOT NULL,
Modified: trunk/Open-ILS/src/sql/Pg/200.schema.acq.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/200.schema.acq.sql 2010-01-14 16:55:27 UTC (rev 15321)
+++ trunk/Open-ILS/src/sql/Pg/200.schema.acq.sql 2010-01-15 15:57:49 UTC (rev 15322)
@@ -37,6 +37,7 @@
code TEXT NOT NULL,
holding_tag TEXT,
san TEXT,
+ edi_default INT, -- REFERENCES acq.edi_account (id) DEFERRABLE INITIALLY DEFERRED
CONSTRAINT provider_name_once_per_owner UNIQUE (name,owner),
CONSTRAINT code_once_per_owner UNIQUE (code, owner)
);
@@ -559,6 +560,14 @@
CONSTRAINT acq_fy_physical_key UNIQUE ( calendar, year_begin )
);
+CREATE TABLE acq.edi_account ( -- similar tables can extend remote_account for other parts of EG
+ provider INT NOT NULL REFERENCES acq.provider (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ in_dir TEXT -- incoming messages dir (probably different than config.remote_account.path, the outgoing dir)
+) INHERITS (config.remote_account);
+
+-- We need a UNIQUE constraint here also, to support the FK from acq.provider.edi_default
+ALTER TABLE acq.edi_account ADD CONSTRAINT acq_edi_account_id_unique UNIQUE (id);
+
-- Functions
CREATE TYPE acq.flat_lineitem_holding_subfield AS (lineitem int, holding int, subfield text, data text);
Modified: trunk/Open-ILS/src/sql/Pg/800.fkeys.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/800.fkeys.sql 2010-01-14 16:55:27 UTC (rev 15321)
+++ trunk/Open-ILS/src/sql/Pg/800.fkeys.sql 2010-01-15 15:57:49 UTC (rev 15322)
@@ -37,6 +37,8 @@
ALTER TABLE actor.org_unit ADD CONSTRAINT actor_org_unit_holds_address_fkey FOREIGN KEY (holds_address) REFERENCES actor.org_address (id) DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE actor.org_unit ADD CONSTRAINT actor_org_unit_ill_address_fkey FOREIGN KEY (ill_address) REFERENCES actor.org_address (id) DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE acq.provider ADD CONSTRAINT acq_provider_edi_default_fkey FOREIGN KEY (edi_default) REFERENCES acq.edi_account (id) DEFERRABLE INITIALLY DEFERRED;
+
ALTER TABLE biblio.record_note ADD CONSTRAINT biblio_record_note_record_fkey FOREIGN KEY (record) REFERENCES biblio.record_entry (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE biblio.record_note ADD CONSTRAINT biblio_record_note_creator_fkey FOREIGN KEY (creator) REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE biblio.record_note ADD CONSTRAINT biblio_record_note_editor_fkey FOREIGN KEY (editor) REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED;
@@ -97,6 +99,8 @@
ALTER TABLE config.billing_type ADD CONSTRAINT config_billing_type_owner_fkey FOREIGN KEY (owner) REFERENCES actor.org_unit (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE config.remote_account ADD CONSTRAINT config_remote_account_owner_fkey FOREIGN KEY (owner) REFERENCES actor.org_unit (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+
ALTER TABLE config.org_unit_setting_type ADD CONSTRAINT view_perm_fkey FOREIGN KEY (view_perm) REFERENCES permission.perm_list (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE config.org_unit_setting_type ADD CONSTRAINT update_perm_fkey FOREIGN KEY (update_perm) REFERENCES permission.perm_list (id) DEFERRABLE INITIALLY DEFERRED;
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0133.schema.config_accounts_and_acq_edi.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0133.schema.config_accounts_and_acq_edi.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0133.schema.config_accounts_and_acq_edi.sql 2010-01-15 15:57:49 UTC (rev 15322)
@@ -0,0 +1,28 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0133'); -- atz
+
+CREATE TABLE config.remote_account (
+ id SERIAL PRIMARY KEY,
+ label TEXT NOT NULL,
+ host TEXT NOT NULL, -- name or IP, :port optional
+ username TEXT, -- optional, since we could default to $USER
+ password TEXT, -- optional, since we could use SSH keys, or anonymous login.
+ account TEXT, -- aka profile or FTP "account" command
+ path TEXT, -- aka directory
+ owner INT NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED,
+ last_activity TIMESTAMP WITH TIME ZONE
+);
+
+CREATE TABLE acq.edi_account ( -- similar tables can extend remote_account for other parts of EG
+ provider INT NOT NULL REFERENCES acq.provider (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ in_dir TEXT -- incoming messages dir (probably different than config.remote_account.path, the outgoing dir)
+) INHERITS (config.remote_account);
+
+-- We need a UNIQUE constraint here also, to support the FK in the next command
+ALTER TABLE acq.edi_account ADD CONSTRAINT acq_edi_account_id_unique UNIQUE (id);
+
+-- null edi_default is OK... it has to be, since we have no values in acq.edi_account yet
+ALTER TABLE acq.provider ADD COLUMN edi_default INT REFERENCES acq.edi_account (id) DEFERRABLE INITIALLY DEFERRED;
+
+COMMIT;
More information about the open-ils-commits
mailing list