CREATE OR REPLACE PACKAGE BODY EFT_NOM.cout_system_configuration IS -- Author : HARDYA -- Created : 25/08/2004 14:22:59 -- Purpose : Enter default system configuration details into the SYSTEM_CONFIGURATION table /* $Header: $ Logfile, Revision, Date, Author 25/08/2004: $ Date and time of last checkin $Modtime: $ Date and time of last modification $History: $ */ PROCEDURE add_configuration_item(p_parameter IN VARCHAR2 ,p_value IN VARCHAR2 DEFAULT NULL ,p_description IN VARCHAR2 := NULL) IS BEGIN INSERT INTO system_configuration (parameter ,VALUE ,description) VALUES (upper(p_parameter) ,p_value ,p_description); EXCEPTION WHEN dup_val_on_index THEN UPDATE system_configuration SET VALUE = p_value WHERE parameter = p_parameter; END add_configuration_item; PROCEDURE add_configuration_item_date(p_parameter IN VARCHAR2 ,p_value IN DATE ,p_description IN VARCHAR2 := NULL) IS BEGIN add_configuration_item(p_parameter => p_parameter ,p_value => to_char(p_value ,g_date_format) ,p_description => p_description); END add_configuration_item_date; PROCEDURE create_system_user IS l_cust_id customers.cust_id%TYPE; l_syus_id system_users.syus_id%TYPE; l_inte_id intermediaries.inte_id%TYPE; l_start_date CONSTANT DATE := to_date('1/1/2001' ,'dd/mm/yyyy'); BEGIN BEGIN INSERT INTO customers (code ,NAME ,period_start ,description) VALUES ('SYSTEM' ,'SYSTEM' ,l_start_date ,'System Customer') RETURNING cust_id INTO l_cust_id; EXCEPTION WHEN OTHERS THEN cout_err.report_and_stop; END; BEGIN INSERT INTO intermediaries (NAME ,period_start ,contact_telephone ,contact_fax ,description) VALUES ('SYSTEM' ,l_start_date ,1 ,1 ,'SYSTEM') RETURNING inte_id INTO l_inte_id; EXCEPTION WHEN OTHERS THEN cout_err.report_and_stop; END; BEGIN INSERT INTO system_users (db_username ,first_name ,last_name ,contact_telephone ,contact_fax ,period_start ,description ,inte_id ,cust_id ,user_locked ,password) VALUES ('SYSTEM' ,'SYSTEM' ,'SYSTEM' ,1 ,1 ,to_date('1/1/2001' ,'dd/mm/yyyy') ,'System User' ,l_inte_id ,l_cust_id ,'N' ,'SYSTEM') RETURNING syus_id INTO l_syus_id; EXCEPTION WHEN OTHERS THEN cout_err.report_and_stop; END; BEGIN INSERT INTO intermediary_users (inte_id ,syus_id) VALUES (l_inte_id ,l_syus_id); EXCEPTION WHEN OTHERS THEN cout_err.report_and_stop; END; add_configuration_item('INTE_ID' ,l_inte_id ,'System Intermediary Id'); add_configuration_item('SYUS_ID' ,l_syus_id ,'System User Id'); add_configuration_item('CUST_ID' ,l_cust_id ,'System Customer Id'); EXCEPTION WHEN OTHERS THEN cout_err.report_and_stop; END create_system_user; PROCEDURE create_owner_details IS BEGIN add_configuration_item('CONTACT_FAX' ,'01509 283135' ,'System Contact Fax Number'); add_configuration_item('NAME' ,'LNG Import Manager' ,'System Name'); add_configuration_item('CONTACT_TELEPHONE' ,'01509 282000' ,'System Contact Telephone Number'); add_configuration_item('CONTACT_EMAIL' ,'calms@advantica.biz' ,'System Contact Email Address'); END create_owner_details; PROCEDURE configure_server IS BEGIN add_configuration_item('SYSTEM_SMTP_SERVER' ,'unix143' ,'SMTP server name'); add_configuration_item('SYSTEM_SMTP_PORT' ,'25' ,'SMTP port number'); add_configuration_item('SESSION_TIMEOUT' ,'100' ,'System User Session Timeout in Hours'); add_configuration_item('SHOW_STATUS_MESSAGE' ,'N' ,'Display Ticker Tape Y/N'); add_configuration_item('G_MENU_STYLE' ,'style3' ,'The menu style in use'); add_configuration_item('REDIAL_ATTEMPTS' ,'5' ,'The number of times a redial should be made'); add_configuration_item('FAX_METHOD' ,'E' ,'The method used to fax - F, E, L, N'); add_configuration_item('SEPERATOR' ,'/' ,'The seperator in use by the system - differs between operating systems'); add_configuration_item('ALLOW_SEC_RSS' ,'NO' ,'Is the secure RSS feed enabled?'); add_configuration_item('ALLOW_UNSEC_RSS' ,'NO' ,'Is the unsecure RSS feed enabled?'); add_configuration_item('IMAGE_DIRECTORY' ,'/lngimp/images/' ,'The location of the images'); add_configuration_item('VOICE_MESSAGES_ENABLED' ,'Y' ,'Are voice messages enabled?'); add_configuration_item('FAX_MESSAGES_ENABLED' ,'Y' ,'Are fax messages enabled'); add_configuration_item('VOICE_MESSAGE_DIRECTORY' ,'D:\oracle\grain\voice' ,'Directory where the voice messages are located - the location of the WAV files'); add_configuration_item('FAX_MESSAGE_DIRECTORY' ,'D:\oracle\grain\donebox' ,'The location where the fax messages will be written.'); END configure_server; PROCEDURE create_tanker_items IS BEGIN add_configuration_item('TANKER_SCHEDULE_DAYS' ,'90' ,'Number of days to be considered for tanker schedules'); add_configuration_item('TANKER_RESCHEDULE_TOLERANCE' ,'10' ,'Tolerance for tanker rescheduling'); add_configuration_item('TANKER_CV_LOW_RANGE' ,'35.000000' ,'Tanker CV Low Range'); add_configuration_item('TANKER_CV_HIGH_RANGE' ,'45.000000' ,'Tanker CV High Range'); add_configuration_item('TANKER_WOBBE_LOW_RANGE' ,'45.000000' ,'Tanker Wobbe Low Range'); add_configuration_item('TANKER_WOBBE_HIGH_RANGE' ,'55.000000' ,'Tanker Wobbe High Range'); add_configuration_item('TANKER_UNLOAD_DURATION' ,'12' ,'Default number of hours taken to unload a tanker'); add_configuration_item('UNLOAD_VOLUME_TOLERANCE' ,'2' ,'The percentage tolerance that the volume unloaded from a tanker may deviate from the expected volume.'); add_configuration_item('UNLOAD_ENERGY_TOLERANCE' ,'2' ,'The percentage tolerance that the energy unloaded from a tanker may deviate from the expected energy.'); add_configuration_item('UNLOAD_CV_TOLERANCE' ,'2' ,'The percentage tolerance that the calorific value unloaded from a tanker may deviate from the expected calorific value.'); add_configuration_item('DATA_RETENTION_PERIOD' ,'30' ,'The number of days data in the interface tables should be retained.'); add_configuration_item('CHECK_FILE_UPLOAD_OFFSET_HOURS' ,'1.25' ,'The tolerence for missing file uploads, in decimal hours (i.e. 1.25 = 1 1/4 hours)'); add_configuration_item('CHECK_TANK_NONARR_OFFSET_HOURS' ,'1.25' ,'The tolerence for missing tankers uploads, in decimal hours (i.e. 1.25 = 1 1/4 hours)'); add_configuration_item('CHECK_TANK_SPACE_OFFSET_HOURS' ,'1.25' ,'The offset from the start of the gas day when the space check should run, in decimal hours (i.e. 1.25 = 1 1/4 hours)'); END create_tanker_items; PROCEDURE create_nomination_items IS BEGIN -- add_configuration_item('DEL_NOM_LEAD_TIME' ,'1' ,'The lead time for Delivery Nominations'); add_configuration_item('DEL_NOM_GATE_CLOSURE' ,'3' ,'The gate closure time'); add_configuration_item('DEL_NOM_DAYS_FUTURE' ,'90' ,'The number of days in the future that a delivery'); add_configuration_item('DEL_NOM_OVERRUN_TOL' ,'10' ,'The percentage overrun tolerence that should be applied to delivery nominations'); -- END create_nomination_items; PROCEDURE create_trade_items IS BEGIN -- add_configuration_item('TRADE_LEAD_TIME_CAP_DEL' ,'18' ,'The trade lead time for deliverability, in hours'); add_configuration_item('TRADE_LEAD_TIME_CAP_STOR' ,'18' ,'The trade lead time for storage capacity, in hours.'); add_configuration_item('TRADE_LEAD_TIME_CMOD_DEL' ,'18' ,'The trade lead time for gas, in hours.'); add_configuration_item('BERTHING_SLOT_TRAD_LEAD_TIME' ,'3' ,'Lead time for trading Berthing Entitlement'); -- END create_trade_items; PROCEDURE configure_nomination_period IS BEGIN add_configuration_item('GAS_DAY_OFFSET' ,'6' ,'Number of hours after midnight that the Gas Day starts'); add_configuration_item('STANDARD_PERIOD_LENGTH' ,'24' ,'Standard nomination/allocation period in hours'); END configure_nomination_period; PROCEDURE setup_system_configuration IS BEGIN /* Use SQL to generate the entries... SELECT ' add_configuration_item('''||parameter||''' ,'''||value||''' ,'''||description||'''); ' from system_configuration order by syco_id; */ create_system_user; create_owner_details; configure_server; create_tanker_items; create_nomination_items; create_trade_items; configure_nomination_period; add_configuration_item('SITE_VOLUME_CAPACITY' ,'300000' ,'The volume of LNG the site may contain'); add_configuration_item('SITE_ENERGY_CAPACITY' ,'100000000' ,'The maximum capacity in energy the site can store'); add_configuration_item('DEFAULT_CALORIFIC_VALUE' ,'36.999' ,'The assumed calorific value used when unable to determine actual'); add_configuration_item('BOIL_OFF_DEFAULT' ,'250000' ,'The default site Boil-Off in KWhrs'); add_configuration_item('UNLOAD_DURATION_FOR_BOIL_OFF' ,'1' ,'The number of hours an unload may run before the shipper is allocated the full gas days Boil-Off'); add_configuration_item('ALLOCATION_CUT_OFF' ,'7' ,'The number of days after a gas day allocation may be altered automatically'); add_configuration_item('RECONCILIATION_PERCENTAGE' ,'10' ,'The percentage difference between physical and commercial inventories at which reconciliation should take place'); END setup_system_configuration; FUNCTION get_configuration_item(p_parameter IN VARCHAR2) RETURN VARCHAR2 IS l_value system_configuration.VALUE%TYPE; BEGIN SELECT VALUE INTO l_value FROM system_configuration WHERE parameter = upper(p_parameter); RETURN l_value; EXCEPTION WHEN no_data_found THEN RETURN NULL; END get_configuration_item; FUNCTION get_configuration_item_date(p_parameter IN VARCHAR2) RETURN DATE IS l_value system_configuration.VALUE%TYPE; BEGIN l_value := get_configuration_item(p_parameter); RETURN to_date(l_value ,g_date_format); END get_configuration_item_date; END cout_system_configuration; /