1.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/Bundle.properties Wed Jan 18 09:49:31 2012 +0530
1.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/Bundle.properties Thu Jan 19 09:50:17 2012 +0530
1.3 @@ -3,8 +3,8 @@
1.4 LBL_Plsql_loader_name=PL/SQL Files
1.5 Services/MIMEResolver/PlsqlResolver.xml=PL/SQL Files
1.6 Templates/PLSQL=PL/SQL
1.7 -Templates/PLSQL/LogicalUnit.apy=Logical Unit Implementation
1.8 -Templates/PLSQL/LogicalUnit.api=Logical Unit Specification
1.9 +Templates/PLSQL/LogicalUnit.apy=Utility LU Implementation
1.10 +Templates/PLSQL/LogicalUnit.api=Utility LU Specification
1.11 Templates/PLSQL/Report.rdf=Report Definition
1.12 Templates/PLSQL/Script.upg=Database Upgrade Script
1.13 Templates/PLSQL/Script.cdb=Database Change Script
2.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/api.html Wed Jan 18 09:49:31 2012 +0530
2.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/api.html Thu Jan 19 09:50:17 2012 +0530
2.3 @@ -2,6 +2,6 @@
2.4 <html xmlns="http://www.w3.org/1999/xhtml">
2.5 <head><title/></head>
2.6 <body>
2.7 - <div>Creates a new logical unit specification (API file).</div>
2.8 + <div>Creates a new utility logical unit specification (API file).</div>
2.9 </body>
2.10 </html>
2.11 \ No newline at end of file
3.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/apy.html Wed Jan 18 09:49:31 2012 +0530
3.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/apy.html Thu Jan 19 09:50:17 2012 +0530
3.3 @@ -2,6 +2,6 @@
3.4 <html xmlns="http://www.w3.org/1999/xhtml">
3.5 <head><title/></head>
3.6 <body>
3.7 - <div>Creates a new logical unit implementation (APY file).</div>
3.8 + <div>Creates a new utility logical unit implementation (APY file).</div>
3.9 </body>
3.10 </html>
3.11 \ No newline at end of file
4.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/template.api Wed Jan 18 09:49:31 2012 +0530
4.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/template.api Thu Jan 19 09:50:17 2012 +0530
4.3 @@ -1,152 +1,24 @@
4.4 -----------------------------------------------------------------------------
4.5 --
4.6 --- Logical unit: <<<LU: Put your LU name here>>>
4.7 +-- Logical unit: <<<LU: Put your LU name here>>>
4.8 --
4.9 --- IFS/Design Template Version 2.3
4.10 +-- IFS Developer Studio Template Version 2.5
4.11 --
4.12 --- Date Sign History
4.13 --- ------ ---- -----------------------------------------------------------
4.14 +-- Date Sign History
4.15 +-- ------ ------ ---------------------------------------------------------
4.16 -----------------------------------------------------------------------------
4.17
4.18 -define MODULE = <<<MODULE: Put your module name here>>>
4.19 -define LU = <<<LU: Put your lu name here>>>
4.20 -define SERVICE = <<<SERVICE: Put your system service name here>>>
4.21 -define PKG = <<<PKG: Put your package name here>>>
4.22 -define DOMAIN = <<<DOMAIN: Put your domain name here>>>
4.23 -
4.24 +DEFINE MODULE = <<<MODULE: Put your module name here>>>
4.25 +DEFINE LU = <<<LU: Put your lu name here>>>
4.26 +DEFINE PKG = <<<PKG: Put your package name here>>>
4.27
4.28 PROMPT Creating &PKG specification
4.29
4.30 CREATE OR REPLACE PACKAGE &PKG IS
4.31
4.32 -module_ CONSTANT VARCHAR2(25) := '&MODULE';
4.33 -lu_name_ CONSTANT VARCHAR2(25) := '&LU';
4.34 -domain_ CONSTANT VARCHAR2(25) := '&DOMAIN';
4.35 -service_ CONSTANT VARCHAR2(25) := '&SERVICE';
4.36 -
4.37 -<<<PUBREC: public record definition>>>
4.38 -
4.39 ------------------------------------------------------------------------------
4.40 --------------- STATEPACKAGE: PRIVATE FINITE STATE MACHINE -------------------
4.41 ------------------------------------------------------------------------------
4.42 -
4.43 -FUNCTION Finite_State_Decode__ (
4.44 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2;
4.45 -PRAGMA restrict_references(Finite_State_Decode__, WNDS);
4.46 -
4.47 -FUNCTION Finite_State_Encode__ (
4.48 - client_state_ IN VARCHAR2 ) RETURN VARCHAR2;
4.49 -PRAGMA restrict_references(Finite_State_Encode__, WNDS);
4.50 -
4.51 -PROCEDURE Enumerate_States__ (
4.52 - client_values_ OUT VARCHAR2 );
4.53 -
4.54 -FUNCTION Finite_State_Events__ (
4.55 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2;
4.56 -PRAGMA restrict_references(Finite_State_Events__, WNDS);
4.57 -
4.58 -PROCEDURE Enumerate_Events__ (
4.59 - db_events_ OUT VARCHAR2 );
4.60 -
4.61 ------------------------------------------------------------------------------
4.62 --------------------- PRIVATE FINITE STATE MACHINE ---------------------------
4.63 ------------------------------------------------------------------------------
4.64 -
4.65 -FUNCTION Finite_State_Decode__ (
4.66 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2;
4.67 -PRAGMA restrict_references(Finite_State_Decode__, WNDS);
4.68 -
4.69 -FUNCTION Finite_State_Encode__ (
4.70 - client_state_ IN VARCHAR2 ) RETURN VARCHAR2;
4.71 -PRAGMA restrict_references(Finite_State_Encode__, WNDS);
4.72 -
4.73 -PROCEDURE Enumerate_States__ (
4.74 - client_values_ OUT VARCHAR2 );
4.75 -
4.76 -FUNCTION Finite_State_Events__ (
4.77 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2;
4.78 -PRAGMA restrict_references(Finite_State_Events__, WNDS);
4.79 -
4.80 -PROCEDURE Enumerate_Events__ (
4.81 - db_events_ OUT VARCHAR2 );
4.82 -
4.83 ------------------------------------------------------------------------------
4.84 --------------------- PRIVATE BASE METHODS -----------------------------------
4.85 ------------------------------------------------------------------------------
4.86 -
4.87 -PROCEDURE Lock__ (
4.88 - info_ OUT VARCHAR2,
4.89 - objid_ IN VARCHAR2,
4.90 - objversion_ IN VARCHAR2 );
4.91 -
4.92 -PROCEDURE New__ (
4.93 - info_ OUT VARCHAR2,
4.94 - objid_ OUT VARCHAR2,
4.95 - objversion_ OUT VARCHAR2,
4.96 - attr_ IN OUT VARCHAR2,
4.97 - action_ IN VARCHAR2 );
4.98 -
4.99 -PROCEDURE Modify__ (
4.100 - info_ OUT VARCHAR2,
4.101 - objid_ IN VARCHAR2,
4.102 - objversion_ IN OUT VARCHAR2,
4.103 - attr_ IN OUT VARCHAR2,
4.104 - action_ IN VARCHAR2 );
4.105 -
4.106 -PROCEDURE Remove__ (
4.107 - info_ OUT VARCHAR2,
4.108 - objid_ IN VARCHAR2,
4.109 - objversion_ IN VARCHAR2,
4.110 - action_ IN VARCHAR2 );
4.111 -
4.112 ------------------------------------------------------------------------------
4.113 --------------------- PUBLIC BASE METHODS ------------------------------------
4.114 ------------------------------------------------------------------------------
4.115 -
4.116 -PROCEDURE Exist (
4.117 - <<<KEYARG: Put your primary key parameters here>>> );
4.118 -
4.119 -PROCEDURE Exist_Db (
4.120 - <<<DBKARG: Put your primary key parameters here>>> );
4.121 -
4.122 ------------------------------------------------------------------------------
4.123 --------------------- PUBLIC DOMAIN METHODS ----------------------------------
4.124 ------------------------------------------------------------------------------
4.125 -
4.126 -PROCEDURE Exist (
4.127 - client_value_ IN VARCHAR2 );
4.128 -
4.129 -PROCEDURE Enumerate (
4.130 - client_values_ OUT VARCHAR2 );
4.131 -
4.132 -PROCEDURE Exist_Db (
4.133 - db_value_ IN VARCHAR2 );
4.134 -
4.135 ------------------------------------------------------------------------------
4.136 --------------------- PUBLIC DOMAIN METHODS ----------------------------------
4.137 ------------------------------------------------------------------------------
4.138 -
4.139 -FUNCTION Encode (
4.140 - client_value_ IN VARCHAR2 ) RETURN VARCHAR2;
4.141 -PRAGMA restrict_references(Encode, WNDS);
4.142 -
4.143 -FUNCTION Decode (
4.144 - db_value_ IN VARCHAR2 ) RETURN VARCHAR2;
4.145 -PRAGMA restrict_references(Decode, WNDS);
4.146 -
4.147 -FUNCTION Get_Db_Value (
4.148 - index_ IN NUMBER ) RETURN VARCHAR2;
4.149 -PRAGMA restrict_references(Get_Db_Value, WNDS);
4.150 -
4.151 -FUNCTION Get_Client_Value (
4.152 - index_ IN NUMBER ) RETURN VARCHAR2;
4.153 -PRAGMA restrict_references(Get_Client_Value, WNDS);
4.154 -
4.155 ------------------------------------------------------------------------------
4.156 --------------------- PUBLIC TRANSLATION METHODS -----------------------------
4.157 ------------------------------------------------------------------------------
4.158 -
4.159 -PROCEDURE Language_Refreshed;
4.160 +module_ CONSTANT VARCHAR2(25) := '&MODULE';
4.161 +lu_name_ CONSTANT VARCHAR2(25) := '&LU';
4.162 +lu_type_ CONSTANT VARCHAR2(15) := 'Utility';
4.163
4.164 -----------------------------------------------------------------------------
4.165 -------------------- LU SPECIFIC PRIVATE METHODS ----------------------------
4.166 @@ -164,124 +36,15 @@
4.167
4.168
4.169 -----------------------------------------------------------------------------
4.170 --------------------- SERVICE SPECIFIC PRIVATE METHODS -----------------------
4.171 ------------------------------------------------------------------------------
4.172 -
4.173 -
4.174 ------------------------------------------------------------------------------
4.175 --------------------- SERVICE SPECIFIC PROTECTED METHODS ---------------------
4.176 ------------------------------------------------------------------------------
4.177 -
4.178 -
4.179 ------------------------------------------------------------------------------
4.180 --------------------- SERVICE SPECIFIC PUBLIC METHODS ------------------------
4.181 ------------------------------------------------------------------------------
4.182 -
4.183 -
4.184 ------------------------------------------------------------------------------
4.185 -------------------- FOUNDATION1 METHODS ------------------------------------
4.186 -----------------------------------------------------------------------------
4.187
4.188 PROCEDURE Init;
4.189
4.190 -
4.191 END &PKG;
4.192 /
4.193 SHOW ERROR
4.194
4.195 -undefine MODULE
4.196 -undefine LU
4.197 -undefine SERVICE
4.198 -undefine PKG
4.199 -undefine DOMAIN
4.200 -
4.201 ------------------------------------------------------------------------------
4.202 ------------------------------ STATEPACKAGE ----------------------------------
4.203 ------------------------------------------------------------------------------
4.204 --- Separate Finite State Machine Package
4.205 ------------------------------------------------------------------------------
4.206 -
4.207 -define VIEW = <<<VIEW: Put your view name here>>>
4.208 -define STATEPKG = <<<STATEPKG: Put your statepackage name here>>>
4.209 -
4.210 -define OBJID = <<<OBJID: Put your object key (or rowid) here>>>
4.211 -define OBJVERSION = <<<OBJVER: Put your objversion column (or list) here>>>
4.212 -define OBJSTATE = <<<OBJSTA: Put your object state column here>>>
4.213 -define OBJEVENTS = <<<OBJEVE: Put your object events column here>>>
4.214 -define STATE = <<<STATE: Put your encoded object state column here>>>
4.215 -
4.216 -
4.217 -PROMPT Creating &VIEW view
4.218 -
4.219 -CREATE OR REPLACE VIEW &VIEW AS
4.220 -SELECT <<<VIEWCOL: Put your view column here>>>
4.221 -FROM <<<VIEWTAB: Put your view table(s) here>>>
4.222 -WHERE <<<VIEWSEC: Put your security restrictions on rows here>>>
4.223 -WITH read only;
4.224 -
4.225 -
4.226 -
4.227 -PROMPT Creating &STATEPKG specification
4.228 -
4.229 -CREATE OR REPLACE PACKAGE &STATEPKG IS
4.230 -
4.231 -module_ CONSTANT VARCHAR2(25) := '&MODULE';
4.232 -lu_name_ CONSTANT VARCHAR2(25) := '&LU';
4.233 -
4.234 ------------------------------------------------------------------------------
4.235 ----------------- STATEPACKAGE IMPLEMENTATION METHODS ------------------------
4.236 ------------------------------------------------------------------------------
4.237 -
4.238 -PROCEDURE Finite_State_Machine___ (
4.239 - rec_ IN OUT &VIEW%ROWTYPE,
4.240 - event_ IN VARCHAR2,
4.241 - attr_ IN OUT VARCHAR2 );
4.242 -
4.243 ------------------------------------------------------------------------------
4.244 --------------------- STATEPACKAGE PRIVATE METHODS ---------------------------
4.245 ------------------------------------------------------------------------------
4.246 -
4.247 -FUNCTION Finite_State_Decode__ (
4.248 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2;
4.249 -PRAGMA restrict_references(Finite_State_Decode__, WNDS);
4.250 -
4.251 -FUNCTION Finite_State_Encode__ (
4.252 - client_state_ IN VARCHAR2 ) RETURN VARCHAR2;
4.253 -PRAGMA restrict_references(Finite_State_Encode__, WNDS);
4.254 -
4.255 -PROCEDURE Enumerate_States__ (
4.256 - client_values_ OUT VARCHAR2);
4.257 -
4.258 -FUNCTION Finite_State_Events__ (
4.259 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2;
4.260 -PRAGMA restrict_references(Finite_State_Events__, WNDS);
4.261 -
4.262 -PROCEDURE Enumerate_Events__ (
4.263 - db_events_ OUT VARCHAR2 );
4.264 -
4.265 ------------------------------------------------------------------------------
4.266 ------------------- STATEPACKAGE TRANSLATION METHODS -------------------------
4.267 ------------------------------------------------------------------------------
4.268 -
4.269 -PROCEDURE Language_Refreshed;
4.270 -
4.271 ------------------------------------------------------------------------------
4.272 -------------------- STATEPACKAGE FOUNDATION1 METHODS ------------------------
4.273 ------------------------------------------------------------------------------
4.274 -
4.275 -PROCEDURE Init;
4.276 -
4.277 -
4.278 -END &STATEPKG;
4.279 -/
4.280 -SHOW ERROR
4.281 -
4.282 -undefine VIEW
4.283 -undefine STATEPKG
4.284 -
4.285 -undefine OBJID
4.286 -undefine OBJVERSION
4.287 -undefine OBJSTATE
4.288 -undefine OBJEVENTS
4.289 -undefine STATE
4.290 -
4.291 +UNDEFINE MODULE
4.292 +UNDEFINE LU
4.293 +UNDEFINE PKG
5.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/template.apy Wed Jan 18 09:49:31 2012 +0530
5.2 +++ b/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/template.apy Thu Jan 19 09:50:17 2012 +0530
5.3 @@ -2,869 +2,21 @@
5.4 --
5.5 -- Logical unit: <<<LU: Put your LU name here>>>
5.6 --
5.7 --- Purpose:
5.8 +-- IFS Developer Studio Template Version 2.5
5.9 --
5.10 --- IFS/Design Template Version 2.3
5.11 ---
5.12 --- Date Sign History
5.13 --- ------ ---- -----------------------------------------------------------
5.14 +-- Date Sign History
5.15 +-- ------ ------ ---------------------------------------------------------
5.16 -----------------------------------------------------------------------------
5.17
5.18 -define MODULE = <<<MODULE: Put your module name here>>>
5.19 -define LU = <<<LU: Put your lu name here>>>
5.20 -define SERVICE = <<<SERVICE: Put your system service name here>>>
5.21 -define TABLE = <<<TABLE: Put your TABLE name here>>>
5.22 -define VIEW = <<<VIEW: Put your view name here>>>
5.23 -define PKG = <<<PKG: Put your package name here>>>
5.24 -define STATEPKG = <<<STATEPKG: Put your statepackage name here>>>
5.25 -define DOMAIN = <<<DOMAIN: Put your domain name here>>>
5.26 +DEFINE MODULE = <<<MODULE: Put your module name here>>>
5.27 +DEFINE LU = <<<LU: Put your lu name here>>>
5.28 +DEFINE PKG = <<<PKG: Put your package name here>>>
5.29
5.30 -define OBJID = <<<OBJID: Put your object key (or rowid) here>>>
5.31 -define OBJVERSION = <<<OBJVER: Put your objversion column (or list) here>>>
5.32 -define OBJSTATE = <<<OBJSTA: Put your object state column here>>>
5.33 -define OBJEVENTS = <<<OBJEVE: Put your object events column here>>>
5.34 -define STATE = <<<STATE: Put your encoded object state column here>>>
5.35 -define DB_VALUES = <<<DBVAL: Put your database stored domain values here>>>
5.36 -define CLIENT_VALUES = <<<PROGVAL: Put your client PROG domain values here>>>
5.37 -
5.38 ------------------------------------------------------------------------------
5.39 --------------------- VIEWS FOR SELECTS --------------------------------------
5.40 ------------------------------------------------------------------------------
5.41 -
5.42 -PROMPT Creating &VIEW view
5.43 -
5.44 -CREATE OR REPLACE VIEW &VIEW AS
5.45 -SELECT <<<VIEWCOL: Put your view column here>>>
5.46 -FROM <<<VIEWTAB: Put your view table(s) here>>>
5.47 -WHERE <<<VIEWSEC: Put your security restrictions on rows here>>>
5.48 -WITH read only;
5.49 -
5.50 ------------------------------------------------------------------------------
5.51 --------------------- PACKAGES FOR METHODS -----------------------------------
5.52 ------------------------------------------------------------------------------
5.53 -
5.54 -PROMPT Creating &PKG implementation
5.55 +PROMPT Creating &PKG specification
5.56
5.57 CREATE OR REPLACE PACKAGE BODY &PKG IS
5.58
5.59 -----------------------------------------------------------------------------
5.60 --------------------- DOMAIN DECLARATIONS ------------------------------------
5.61 ------------------------------------------------------------------------------
5.62 -
5.63 -db_value_list_ CONSTANT VARCHAR2(<<<DBLENGTH: Length of db_value_list_>>>) := '&DB_VALUES';
5.64 -client_value_list_ CONSTANT VARCHAR2(<<<CLENGTH: Length of client_value_list_>>>) := '&CLIENT_VALUES';
5.65 -active_value_list_ VARCHAR2(<<<ALENGTH: Length of active_value_list_>>>) := Language_SYS.Translate_Iid_(lu_name_, client_value_list_);
5.66 -
5.67 ------------------------------------------------------------------------------
5.68 --------------------- FINITE STATE DECLARATIONS ------------------------------
5.69 ------------------------------------------------------------------------------
5.70 -
5.71 -db_state_list_ CONSTANT VARCHAR2(<<<DBSTATEL: Length of db_state_list_>>>) := '&DB_STATES';
5.72 -client_state_list_ CONSTANT VARCHAR2(<<<CSTATEL: Length of client_state_list_>>>) := '&CLIENT_STATES';
5.73 -active_state_list_ VARCHAR2(<<<ASTATEL: Length of active_state_list_>>>) := Language_SYS.Translate_State_(lu_name_, client_state_list_);
5.74 -state_separator_ CONSTANT VARCHAR2(1) := Client_SYS.field_separator_;
5.75 -
5.76 ------------------------------------------------------------------------------
5.77 --------------------- LU SPECIFIC IMPLEMENTATION METHOD DECLARATIONS ---------
5.78 ------------------------------------------------------------------------------
5.79 -
5.80 -
5.81 ------------------------------------------------------------------------------
5.82 --------------------- SERVICE SPECIFIC IMPLEMENTATION METHOD DECLARATIONS ----
5.83 ------------------------------------------------------------------------------
5.84 -
5.85 -
5.86 ------------------------------------------------------------------------------
5.87 --------------------- IMPLEMENTATION BASE METHODS ----------------------------
5.88 ------------------------------------------------------------------------------
5.89 --- Lock_By_Id___
5.90 --- Client-support to lock a specific instance of the logical unit.
5.91 ---
5.92 --- Lock_By_Keys___
5.93 --- Server support to lock a specific instance of the logical unit.
5.94 ---
5.95 --- Get_Object_By_Id___
5.96 --- Get LU-record from the database with a specified object identity.
5.97 ---
5.98 --- Get_Object_By_Keys___
5.99 --- Get LU-record from the database with specified key columns.
5.100 ---
5.101 --- Check_Exist___
5.102 --- Check if a specific LU-instance already exist in the database.
5.103 ---
5.104 --- Get_Id_Version_By_Keys___
5.105 --- Get the current OBJID and OBJVERSION for a specific LU-instance.
5.106 ------------------------------------------------------------------------------
5.107 -
5.108 -FUNCTION Lock_By_Id___ (
5.109 - objid_ IN VARCHAR2,
5.110 - objversion_ IN VARCHAR2 ) RETURN &TABLE%ROWTYPE
5.111 -IS
5.112 - row_changed EXCEPTION;
5.113 - row_deleted EXCEPTION;
5.114 - row_locked EXCEPTION;
5.115 - PRAGMA exception_init(row_locked, -0054);
5.116 - rec_ &TABLE%ROWTYPE;
5.117 - dummy_ NUMBER;
5.118 - CURSOR lock_control IS
5.119 - SELECT *
5.120 - FROM &TABLE
5.121 - WHERE &OBJID = objid_
5.122 - AND &OBJVERSION = objversion_
5.123 - FOR UPDATE NOWAIT;
5.124 - CURSOR exist_control IS
5.125 - SELECT 1
5.126 - FROM &TABLE
5.127 - WHERE &OBJID = objid_;
5.128 -BEGIN
5.129 - OPEN lock_control;
5.130 - FETCH lock_control INTO rec_;
5.131 - IF (lock_control%FOUND) THEN
5.132 - CLOSE lock_control;
5.133 - RETURN rec_;
5.134 - END IF;
5.135 - CLOSE lock_control;
5.136 - OPEN exist_control;
5.137 - FETCH exist_control INTO dummy_;
5.138 - IF (exist_control%FOUND) THEN
5.139 - CLOSE exist_control;
5.140 - RAISE row_changed;
5.141 - ELSE
5.142 - CLOSE exist_control;
5.143 - RAISE row_deleted;
5.144 - END IF;
5.145 -EXCEPTION
5.146 - WHEN row_locked THEN
5.147 - Error_SYS.Record_Locked(lu_name_);
5.148 - WHEN row_changed THEN
5.149 - Error_SYS.Record_Modified(lu_name_);
5.150 - WHEN row_deleted THEN
5.151 - Error_SYS.Record_Removed(lu_name_);
5.152 -END Lock_By_Id___;
5.153 -
5.154 -FUNCTION Lock_By_Keys___ (
5.155 - <<<DBKARG: Put your primary key parameters here>>> ) RETURN &TABLE%ROWTYPE
5.156 -IS
5.157 - row_deleted EXCEPTION;
5.158 - rec_ &TABLE%ROWTYPE;
5.159 - CURSOR lock_control IS
5.160 - SELECT *
5.161 - FROM &TABLE
5.162 - WHERE <<<KEYWH2: Put your primary key condition here>>>
5.163 - FOR UPDATE;
5.164 -BEGIN
5.165 - OPEN lock_control;
5.166 - FETCH lock_control INTO rec_;
5.167 - IF (lock_control%FOUND) THEN
5.168 - CLOSE lock_control;
5.169 - RETURN rec_;
5.170 - ELSE
5.171 - CLOSE lock_control;
5.172 - RAISE row_deleted;
5.173 - END IF;
5.174 -EXCEPTION
5.175 - WHEN row_deleted THEN
5.176 - Error_SYS.Record_Removed(lu_name_);
5.177 -END Lock_By_Keys___;
5.178 -
5.179 -FUNCTION Get_Object_By_Id___ (
5.180 - objid_ IN VARCHAR2 ) RETURN &TABLE%ROWTYPE
5.181 -IS
5.182 - lu_rec_ &TABLE%ROWTYPE;
5.183 - CURSOR getrec IS
5.184 - SELECT *
5.185 - FROM &TABLE
5.186 - WHERE &OBJID = objid_;
5.187 -BEGIN
5.188 - OPEN getrec;
5.189 - FETCH getrec INTO lu_rec_;
5.190 - IF (getrec%NOTFOUND) THEN
5.191 - CLOSE getrec;
5.192 - Error_SYS.Record_Removed(lu_name_);
5.193 - END IF;
5.194 - CLOSE getrec;
5.195 - RETURN(lu_rec_);
5.196 -END Get_Object_By_Id___;
5.197 -
5.198 -
5.199 -FUNCTION Get_Object_By_Keys___ (
5.200 - <<<DBKARG: Put your primary key parameters here>>> ) RETURN &TABLE%ROWTYPE
5.201 -IS
5.202 - lu_rec_ &TABLE%ROWTYPE;
5.203 - CURSOR getrec IS
5.204 - SELECT *
5.205 - FROM &TABLE
5.206 - WHERE <<<KEYWH2: Put your primary key condition here>>>;
5.207 -BEGIN
5.208 - OPEN getrec;
5.209 - FETCH getrec INTO lu_rec_;
5.210 - CLOSE getrec;
5.211 - RETURN(lu_rec_);
5.212 -END Get_Object_By_Keys___;
5.213 -
5.214 -FUNCTION Check_Exist___ (
5.215 - <<<DBKARG: Put your primary key parameters here>>> ) RETURN BOOLEAN
5.216 -IS
5.217 - dummy_ NUMBER;
5.218 - CURSOR exist_control IS
5.219 - SELECT 1
5.220 - FROM &TABLE
5.221 - WHERE <<<KEYWH2: Put your primary key condition here>>>;
5.222 -BEGIN
5.223 - OPEN exist_control;
5.224 - FETCH exist_control INTO dummy_;
5.225 - IF (exist_control%FOUND) THEN
5.226 - CLOSE exist_control;
5.227 - RETURN(TRUE);
5.228 - END IF;
5.229 - CLOSE exist_control;
5.230 - RETURN(FALSE);
5.231 -END Check_Exist___;
5.232 -
5.233 -PROCEDURE Get_Id_Version_By_Keys___ (
5.234 - objid_ IN OUT VARCHAR2,
5.235 - objversion_ IN OUT VARCHAR2,
5.236 - <<<DBKARG: Put your primary key parameters here>>>)
5.237 -IS
5.238 - CURSOR get_version IS
5.239 - SELECT &OBJID, &OBJVERSION
5.240 - FROM &TABLE
5.241 - WHERE <<<KEYWH2: Put your primary key condition here>>>;
5.242 -BEGIN
5.243 - OPEN get_version;
5.244 - FETCH get_version INTO objid_, objversion_;
5.245 - CLOSE get_version;
5.246 -END Get_Id_Version_By_Keys___;
5.247 -
5.248 ------------------------------------------------------------------------------
5.249 ------------- STATEPACKAGE: IMPLEMENTATION FINITE STATE MACHINE --------------
5.250 ------------------------------------------------------------------------------
5.251 --- This set of Implementation Finite State Machine methods should be used if
5.252 --- a separate package is used for the Finite State Machine implementation.
5.253 ---
5.254 --- Finite_State_Machine___
5.255 --- Redirect call to separate Finite State Machine Package
5.256 ---
5.257 --- Finite_State_Add_To_Attr___
5.258 --- Adds the current state and allowed events to the attribute string.
5.259 ---
5.260 --- Finite_State_Init___
5.261 --- Sets the initial finite state indicator for an existing LU-instance
5.262 --- and processes any automatic events.
5.263 ------------------------------------------------------------------------------
5.264 -
5.265 -PROCEDURE Finite_State_Machine___ (
5.266 - rec_ IN OUT &TABLE%ROWTYPE,
5.267 - event_ IN VARCHAR2,
5.268 - attr_ IN OUT VARCHAR2 )
5.269 -IS
5.270 -BEGIN
5.271 - &STATEPKG..Finite_State_Machine___(rec_, event_, attr_);
5.272 -END Finite_State_Machine___;
5.273 -
5.274 -
5.275 -PROCEDURE Finite_State_Add_To_Attr___ (
5.276 - rec_ IN &TABLE%ROWTYPE,
5.277 - attr_ IN OUT VARCHAR2 )
5.278 -IS
5.279 - state_ VARCHAR2(30);
5.280 -BEGIN
5.281 - <<<FSFETCH: Put your own SQL-statement here to fetch the current state>>>;
5.282 - Client_SYS.Add_To_Attr('__OBJSTATE', state_, attr_);
5.283 - Client_SYS.Add_To_Attr('__OBJEVENTS', Finite_State_Events__(state_), attr_);
5.284 - Client_SYS.Add_To_Attr('STATE', Finite_State_Decode__(state_), attr_);
5.285 -END Finite_State_Add_To_Attr___;
5.286 -
5.287 -
5.288 -PROCEDURE Finite_State_Init___ (
5.289 - rec_ IN OUT &TABLE%ROWTYPE,
5.290 - attr_ IN OUT VARCHAR2 )
5.291 -IS
5.292 - state_ VARCHAR2(30);
5.293 -BEGIN
5.294 - Finite_State_Machine___(rec_, NULL, attr_);
5.295 - Finite_State_Add_To_Attr___(rec_, attr_);
5.296 -END Finite_State_Init___;
5.297 -
5.298 ------------------------------------------------------------------------------
5.299 --------------------- IMPLEMENTATION FINITE STATE MACHINE --------------------
5.300 ------------------------------------------------------------------------------
5.301 --- Finite_State_Set___
5.302 --- Updates the finite state indicator for an existing LU-instance.
5.303 ---
5.304 --- Finite_State_Machine___
5.305 --- Processes an event by:
5.306 --- 1. Fetching the current state
5.307 --- 2. Evaluating any conditions for given event at current state
5.308 --- 3. executing any exit code for the old state
5.309 --- 4. Performing any action associated with given event
5.310 --- 5. update the database to the new state
5.311 --- 6. execute any entry code for the new state
5.312 --- 7. Executing a state change to the new state
5.313 ---
5.314 --- Finite_State_Add_To_Attr___
5.315 --- Adds the current state and allowed events to the attribute string.
5.316 ---
5.317 --- Finite_State_Init___
5.318 --- Sets the initial finite state indicator for an existing LU-instance
5.319 --- and processes any automatic events.
5.320 ------------------------------------------------------------------------------
5.321 -
5.322 -PROCEDURE Finite_State_Set___ (
5.323 - rec_ IN OUT &TABLE%ROWTYPE,
5.324 - state_ IN VARCHAR2 )
5.325 -IS
5.326 -BEGIN
5.327 - <<<FSUPDATE: Put your own SQL-statement here to set the new state>>>;
5.328 -END Finite_State_Set___;
5.329 -
5.330 -
5.331 -PROCEDURE Finite_State_Machine___ (
5.332 - rec_ IN OUT &TABLE%ROWTYPE,
5.333 - event_ IN VARCHAR2,
5.334 - attr_ IN OUT VARCHAR2 )
5.335 -IS
5.336 - state_ VARCHAR2(30);
5.337 -BEGIN
5.338 - <<<FSFETCH: Put your own SQL-statement here to fetch the current state>>>;
5.339 - <<<FSEVENT: Code for processing of events>>>;
5.340 -END Finite_State_Machine___;
5.341 -
5.342 -
5.343 -PROCEDURE Finite_State_Add_To_Attr___ (
5.344 - rec_ IN &TABLE%ROWTYPE,
5.345 - attr_ IN OUT VARCHAR2 )
5.346 -IS
5.347 - state_ VARCHAR2(30);
5.348 -BEGIN
5.349 - <<<FSFETCH: Put your own SQL-statement here to fetch the current state>>>;
5.350 - Client_SYS.Add_To_Attr('__OBJSTATE', state_, attr_);
5.351 - Client_SYS.Add_To_Attr('__OBJEVENTS', Finite_State_Events__(state_), attr_);
5.352 - Client_SYS.Add_To_Attr('STATE', Finite_State_Decode__(state_), attr_);
5.353 -END Finite_State_Add_To_Attr___;
5.354 -
5.355 -
5.356 -PROCEDURE Finite_State_Init___ (
5.357 - rec_ IN OUT &TABLE%ROWTYPE,
5.358 - attr_ IN OUT VARCHAR2 )
5.359 -IS
5.360 - state_ VARCHAR2(30);
5.361 -BEGIN
5.362 - Finite_State_Machine___(rec_, NULL, attr_);
5.363 - Finite_State_Add_To_Attr___(rec_, attr_);
5.364 -END Finite_State_Init___;
5.365 -
5.366 ------------------------------------------------------------------------------
5.367 --------------- STATEPACKAGE: PRIVATE FINITE STATE MACHINE -------------------
5.368 ------------------------------------------------------------------------------
5.369 --- This set of Private Finite State Machine methods should be used if a
5.370 --- separate package is used for the Finite State Machine implementation.
5.371 ---
5.372 --- Finite_State_Decode__
5.373 --- Redirect call to separate Finite State Machine Package
5.374 ---
5.375 --- Finite_State_Encode__
5.376 --- Redirect call to separate Finite State Machine Package
5.377 ---
5.378 --- Enumerate_States__
5.379 --- Redirect call to separate Finite State Machine Package
5.380 ---
5.381 --- Finite_State_Events__
5.382 --- Redirect call to separate Finite State Machine Package
5.383 ---
5.384 --- Enumerate_Events__
5.385 --- Redirect call to separate Finite State Machine Package
5.386 ------------------------------------------------------------------------------
5.387 -
5.388 -FUNCTION Finite_State_Decode__ (
5.389 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2
5.390 -IS
5.391 -BEGIN
5.392 - RETURN(&STATEPKG..Finite_State_Decode__(db_state_));
5.393 -END Finite_State_Decode__;
5.394 -
5.395 -
5.396 -FUNCTION Finite_State_Encode__ (
5.397 - client_state_ IN VARCHAR2 ) RETURN VARCHAR2
5.398 -IS
5.399 -BEGIN
5.400 - RETURN(&STATEPKG..Finite_State_Encode__(client_state_));
5.401 -END Finite_State_Encode__;
5.402 -
5.403 -
5.404 -PROCEDURE Enumerate_States__ (
5.405 - client_values_ OUT VARCHAR2 )
5.406 -IS
5.407 -BEGIN
5.408 - &STATEPKG..Enumerate_States__(client_values_);
5.409 -END Enumerate_States__;
5.410 -
5.411 -
5.412 -FUNCTION Finite_State_Events__ (
5.413 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2
5.414 -IS
5.415 -BEGIN
5.416 - RETURN(&STATEPKG..Finite_State_Events__(db_state_));
5.417 -END Finite_State_Events__;
5.418 -
5.419 -
5.420 -PROCEDURE Enumerate_Events__ (
5.421 - db_events_ OUT VARCHAR2 )
5.422 -IS
5.423 -BEGIN
5.424 - &STATEPKG..Enumerate_Events__(db_events_);
5.425 -END Enumerate_Events__;
5.426 -
5.427 ------------------------------------------------------------------------------
5.428 --------------------- PRIVATE FINITE STATE MACHINE ---------------------------
5.429 ------------------------------------------------------------------------------
5.430 --- Finite_State_Decode__
5.431 --- Returns the client equivalent for any database representation of
5.432 --- a state name = objstate.
5.433 ---
5.434 --- Finite_State_Encode__
5.435 --- Returns the database equivalent for any client representation of
5.436 --- a state name = state.
5.437 ---
5.438 --- Enumerate_States__
5.439 --- Returns a list of all possible finite states in client terminology.
5.440 ---
5.441 --- Finite_State_Events__
5.442 --- Returns a list of allowed events for a given state
5.443 --- NOTE! Regardless of conditions if not otherwize encoded
5.444 ---
5.445 --- Enumerate_Events__
5.446 --- Returns a list of all possible events.
5.447 ------------------------------------------------------------------------------
5.448 -
5.449 -FUNCTION Finite_State_Decode__ (
5.450 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2
5.451 -IS
5.452 -BEGIN
5.453 - RETURN(Domain_SYS.Decode_(active_state_list_, db_state_list_, db_state_));
5.454 -END Finite_State_Decode__;
5.455 -
5.456 -
5.457 -FUNCTION Finite_State_Encode__ (
5.458 - client_state_ IN VARCHAR2 ) RETURN VARCHAR2
5.459 -IS
5.460 -BEGIN
5.461 - RETURN(Domain_SYS.Encode_(active_state_list_, db_state_list_, client_state_));
5.462 -END Finite_State_Encode__;
5.463 -
5.464 -
5.465 -PROCEDURE Enumerate_States__ (
5.466 - client_values_ OUT VARCHAR2)
5.467 -IS
5.468 -BEGIN
5.469 - client_values_ := Domain_SYS.Enumerate_(active_state_list_);
5.470 -END Enumerate_States__;
5.471 -
5.472 -
5.473 -FUNCTION Finite_State_Events__ (
5.474 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2
5.475 -IS
5.476 -BEGIN
5.477 - <<<FSEVALID: Put your code for returning valid event list here>>>;
5.478 -END Finite_State_Events__;
5.479 -
5.480 -
5.481 -PROCEDURE Enumerate_Events__ (
5.482 - db_events_ OUT VARCHAR2 )
5.483 -IS
5.484 -BEGIN
5.485 - db_events_ := '<<<FSELIST: Put your code for returning complete event list here>>>';
5.486 -END Enumerate_Events__;
5.487 -
5.488 ------------------------------------------------------------------------------
5.489 --------------------- IMPLEMENTATION BASE METHODS FOR INSERT -----------------
5.490 ------------------------------------------------------------------------------
5.491 --- Prepare_Insert___
5.492 --- Set all default values for a new instance (ON-NEW-RECORD) of this
5.493 --- logical unit by calling procedure Add_Attr.
5.494 ---
5.495 --- Unpack_Check_Insert___
5.496 --- Unpack the attribute list, check all attributes from the client
5.497 --- and generate all default values before creation of the new object.
5.498 ---
5.499 --- Insert___
5.500 --- Insert a new LU-instance into the database and return the values
5.501 --- for OBJID and OBJVERSION.
5.502 ------------------------------------------------------------------------------
5.503 -
5.504 -PROCEDURE Prepare_Insert___ (
5.505 - attr_ IN OUT VARCHAR2 )
5.506 -IS<<<PRPBD1: Declare a temp variable if needed>>>
5.507 -BEGIN
5.508 - <<<PRPBDY: Put the call to the superclass here>>>;
5.509 -END Prepare_Insert___;
5.510 -
5.511 -
5.512 -PROCEDURE Unpack_Check_Insert___ (
5.513 - attr_ IN OUT VARCHAR2,
5.514 - newrec_ IN OUT &TABLE%ROWTYPE )
5.515 -IS
5.516 - ptr_ NUMBER;
5.517 - name_ VARCHAR2(30);
5.518 - value_ VARCHAR2(2000);
5.519 -BEGIN
5.520 - <<<UCIBDY: Put your code here to unpack and do all checkings needed before insert>>>;
5.521 -EXCEPTION
5.522 - WHEN value_error THEN
5.523 - Error_SYS.Item_Format(lu_name_, name_, value_);
5.524 -END Unpack_Check_Insert___;
5.525 -
5.526 -
5.527 -PROCEDURE Insert___ (
5.528 - objid_ OUT VARCHAR2,
5.529 - objversion_ OUT VARCHAR2,
5.530 - newrec_ IN OUT &TABLE%ROWTYPE,
5.531 - attr_ IN OUT VARCHAR2 )
5.532 -IS
5.533 -BEGIN
5.534 - <<<SETVER2: Code for setting the rowversion>>>
5.535 - <<<INSERT: Put your own SQL-statement here to insert the new record>>>;
5.536 - Finite_State_Init___(newrec_, attr_);
5.537 -EXCEPTION
5.538 - WHEN dup_val_on_index THEN
5.539 - Error_SYS.Record_Exist(lu_name_);
5.540 -END Insert___;
5.541 -
5.542 ------------------------------------------------------------------------------
5.543 --------------------- IMPLEMENTATION BASE METHODS FOR UPDATE -----------------
5.544 ------------------------------------------------------------------------------
5.545 --- Unpack_Check_Update___
5.546 --- Unpack the attribute list, check all attributes from the client
5.547 --- and generate all default values before modifying the object.
5.548 ---
5.549 --- Update___
5.550 --- Update an existing LU-instance in the database and return the
5.551 --- the new OBJVERSION.
5.552 ------------------------------------------------------------------------------
5.553 -
5.554 -PROCEDURE Unpack_Check_Update___ (
5.555 - attr_ IN OUT VARCHAR2,
5.556 - newrec_ IN OUT &TABLE%ROWTYPE,
5.557 - objid_ IN VARCHAR2 )
5.558 -IS
5.559 - ptr_ NUMBER;
5.560 - name_ VARCHAR2(30);
5.561 - value_ VARCHAR2(2000);
5.562 -BEGIN
5.563 - <<<UCUBDY: Put your code here to unpack and do all checkings needed before update>>>;
5.564 -EXCEPTION
5.565 - WHEN value_error THEN
5.566 - Error_SYS.Item_Format(lu_name_, name_, value_);
5.567 -END Unpack_Check_Update___;
5.568 -
5.569 -
5.570 -PROCEDURE Update___ (
5.571 - objid_ IN VARCHAR2,
5.572 - oldrec_ IN &TABLE%ROWTYPE,
5.573 - newrec_ IN OUT &TABLE%ROWTYPE,
5.574 - attr_ IN OUT VARCHAR2,
5.575 - objversion_ IN OUT VARCHAR2,
5.576 - by_keys_ IN BOOLEAN DEFAULT FALSE )
5.577 -IS
5.578 -BEGIN
5.579 - <<<SETVER: Code for setting the rowversion>>>
5.580 - IF by_keys_ THEN
5.581 - <<<UPDATE: Put your own SQL-statement here to update the new record>>>
5.582 - WHERE <<<RECWHR: Put your primary key condition here>>>;
5.583 - ELSE
5.584 - <<<UPDATE: Put your own SQL-statement here to update the new record>>>
5.585 - WHERE &OBJID = objid_;
5.586 - END IF;
5.587 -EXCEPTION
5.588 - WHEN dup_val_on_index THEN
5.589 - Error_SYS.Record_Exist(lu_name_);
5.590 -END Update___;
5.591 -
5.592 ------------------------------------------------------------------------------
5.593 --------------------- IMPLEMENTATION BASE METHODS FOR DELETE -----------------
5.594 ------------------------------------------------------------------------------
5.595 --- Check_Delete___
5.596 --- Checks whether a specific LU-record may be removed or not.
5.597 --- The procedure should check business rules like attribute values
5.598 --- as well as database constraints (defined or not).
5.599 ---
5.600 --- Delete___
5.601 --- Deletion of the specific LU-object from the database.
5.602 ------------------------------------------------------------------------------
5.603 -
5.604 -PROCEDURE Check_Delete___ (
5.605 - remrec_ IN &TABLE%ROWTYPE )
5.606 -IS
5.607 - key_ VARCHAR2(2000);
5.608 -BEGIN
5.609 - key_ := <<<KEYCAT: Put your primary keys here>>>;
5.610 - Reference_SYS.Check_Restricted_Delete(lu_name_, key_);
5.611 -END Check_Delete___;
5.612 -
5.613 -
5.614 -PROCEDURE Delete___ (
5.615 - objid_ IN VARCHAR2,
5.616 - remrec_ IN &TABLE%ROWTYPE )
5.617 -IS
5.618 - key_ VARCHAR2(2000);
5.619 -BEGIN
5.620 - key_ := <<<KEYCAT: Put your primary keys here>>>;
5.621 - Reference_SYS.Do_Cascade_Delete(lu_name_, key_);
5.622 - <<<DELETE: Put your own SQL-statement here to delete the old record>>>;
5.623 -END Delete___;
5.624 -
5.625 ------------------------------------------------------------------------------
5.626 --------------------- PRIVATE BASE METHODS -----------------------------------
5.627 ------------------------------------------------------------------------------
5.628 --- Lock__
5.629 --- Client-support to lock a specific instance of the logical unit.
5.630 ---
5.631 --- New__
5.632 --- Client-support interface to create LU instances.
5.633 --- action_ = 'PREPARE'
5.634 --- Default values and handle of information to client.
5.635 --- The default values are set in procedure Prepare_Insert___.
5.636 --- action_ = 'CHECK'
5.637 --- Check all attributes before creating new object and handle of
5.638 --- information to client. The attribute list is unpacked, checked
5.639 --- and prepared (defaults) in procedure Unpack_Check_Insert___.
5.640 --- action_ = 'DO'
5.641 --- Creation of new instances of the logical unit and handle of
5.642 --- information to client. The attribute list is unpacked, checked
5.643 --- and prepared (defaults) in procedure Unpack_Check_Insert___
5.644 --- before calling procedure Insert___.
5.645 ---
5.646 --- Modify__
5.647 --- Client-support interface to modify attributes for LU instances.
5.648 --- action_ = 'CHECK'
5.649 --- Check all attributes before modifying an existing object and
5.650 --- handle of information to client. The attribute list is unpacked,
5.651 --- checked and prepared(defaults) in procedure Unpack_Check_Update___.
5.652 --- action_ = 'DO'
5.653 --- Modification of an existing instance of the logical unit. The
5.654 --- procedure unpacks the attributes, checks all values before
5.655 --- procedure Update___ is called.
5.656 ---
5.657 --- Remove__
5.658 --- Client-support interface to remove LU instances.
5.659 --- action_ = 'CHECK'
5.660 --- Check whether a specific LU-instance may be removed or not.
5.661 --- The procedure fetches the complete record by calling procedure
5.662 --- Get_Object_By_Id___. Then the check is made by calling procedure
5.663 --- Check_Delete___.
5.664 --- action_ = 'DO'
5.665 --- Remove an existing instance of the logical unit. The procedure
5.666 --- fetches the complete LU-record, checks for a delete and then
5.667 --- deletes the record by calling procedure Delete___.
5.668 ------------------------------------------------------------------------------
5.669 -
5.670 -PROCEDURE Lock__ (
5.671 - info_ OUT VARCHAR2,
5.672 - objid_ IN VARCHAR2,
5.673 - objversion_ IN VARCHAR2 )
5.674 -IS
5.675 - dummy_ &TABLE%ROWTYPE;
5.676 -BEGIN
5.677 - General_SYS.Init_Method(lu_name_, '&PKG', 'Lock__');
5.678 - dummy_ := Lock_By_Id___(objid_, objversion_);
5.679 - info_ := Client_SYS.Get_All_Info;
5.680 -END Lock__;
5.681 -
5.682 -
5.683 -PROCEDURE New__ (
5.684 - info_ OUT VARCHAR2,
5.685 - objid_ OUT VARCHAR2,
5.686 - objversion_ OUT VARCHAR2,
5.687 - attr_ IN OUT VARCHAR2,
5.688 - action_ IN VARCHAR2 )
5.689 -IS
5.690 - newrec_ &TABLE%ROWTYPE;
5.691 -BEGIN
5.692 - General_SYS.Init_Method(lu_name_, '&PKG', 'New__');
5.693 - IF (action_ = 'PREPARE') THEN
5.694 - Prepare_Insert___(attr_);
5.695 - ELSIF (action_ = 'CHECK') THEN
5.696 - Unpack_Check_Insert___(attr_, newrec_);
5.697 - ELSIF (action_ = 'DO') THEN
5.698 - Unpack_Check_Insert___(attr_, newrec_);
5.699 - Insert___(objid_, objversion_, newrec_, attr_);
5.700 - END IF;
5.701 - info_ := Client_SYS.Get_All_Info;
5.702 -END New__;
5.703 -
5.704 -
5.705 -PROCEDURE Modify__ (
5.706 - info_ OUT VARCHAR2,
5.707 - objid_ IN VARCHAR2,
5.708 - objversion_ IN OUT VARCHAR2,
5.709 - attr_ IN OUT VARCHAR2,
5.710 - action_ IN VARCHAR2 )
5.711 -IS
5.712 - oldrec_ &TABLE%ROWTYPE;
5.713 - newrec_ &TABLE%ROWTYPE;
5.714 -BEGIN
5.715 - General_SYS.Init_Method(lu_name_, '&PKG', 'Modify__');
5.716 - IF (action_ = 'CHECK') THEN
5.717 - newrec_ := Get_Object_By_Id___(objid_);
5.718 - Unpack_Check_Update___(attr_, newrec_, objid_);
5.719 - ELSIF (action_ = 'DO') THEN
5.720 - oldrec_ := Lock_By_Id___(objid_, objversion_);
5.721 - newrec_ := oldrec_;
5.722 - Unpack_Check_Update___(attr_, newrec_, objid_);
5.723 - Update___(objid_, oldrec_, newrec_, attr_, objversion_);
5.724 - END IF;
5.725 - info_ := Client_SYS.Get_All_Info;
5.726 -END Modify__;
5.727 -
5.728 -
5.729 -PROCEDURE Remove__ (
5.730 - info_ OUT VARCHAR2,
5.731 - objid_ IN VARCHAR2,
5.732 - objversion_ IN VARCHAR2,
5.733 - action_ IN VARCHAR2 )
5.734 -IS
5.735 - remrec_ &TABLE%ROWTYPE;
5.736 -BEGIN
5.737 - General_SYS.Init_Method(lu_name_, '&PKG', 'Remove__');
5.738 - IF (action_ = 'CHECK') THEN
5.739 - remrec_ := Get_Object_By_Id___(objid_);
5.740 - Check_Delete___(remrec_);
5.741 - ELSIF (action_ = 'DO') THEN
5.742 - remrec_ := Lock_By_Id___(objid_, objversion_);
5.743 - Check_Delete___(remrec_);
5.744 - Delete___(objid_, remrec_);
5.745 - END IF;
5.746 - info_ := Client_SYS.Get_All_Info;
5.747 -END Remove__;
5.748 -
5.749 ------------------------------------------------------------------------------
5.750 --------------------- PUBLIC BASE METHODS ------------------------------------
5.751 ------------------------------------------------------------------------------
5.752 --- Exist
5.753 --- Checks if given pointer (e.g. primary key) to an instance of this
5.754 --- logical unit exists. If not an exception will be raised.
5.755 ------------------------------------------------------------------------------
5.756 -
5.757 -PROCEDURE Exist (
5.758 - <<<KEYARG: Put your primary key parameters here>>> )
5.759 -IS
5.760 -BEGIN
5.761 - General_SYS.Init_Method(lu_name_, '&PKG', 'Exist', TRUE);
5.762 - IF (NOT Check_Exist___(<<<KEYLS2: Put your parameters here>>>)) THEN
5.763 - Error_SYS.Record_Not_Exist(lu_name_);
5.764 - END IF;
5.765 -END Exist;
5.766 -
5.767 -PROCEDURE Exist_Db (
5.768 - <<<DBKARG: Put your primary key parameters here>>> )
5.769 -IS
5.770 -BEGIN
5.771 - General_SYS.Init_Method(lu_name_, '&PKG', 'Exist', TRUE);
5.772 - IF (NOT Check_Exist___(<<<KEYLDB: Put your parameters here>>>)) THEN
5.773 - Error_SYS.Record_Not_Exist(lu_name_);
5.774 - END IF;
5.775 -END Exist_Db;
5.776 -
5.777 ------------------------------------------------------------------------------
5.778 --------------------- PUBLIC DOMAIN METHODS ----------------------------------
5.779 ------------------------------------------------------------------------------
5.780 --- Exist
5.781 --- Checks if given pointer (e.g. domain value) to an instance of this
5.782 --- logical unit exists. If not an exception will be raised.
5.783 ---
5.784 --- Enumerate
5.785 --- Returns a list of all domain values.
5.786 ---
5.787 --- Exist_Db
5.788 --- Checks if an instance corresponding to a given database value exists.
5.789 --- If not an exception will be raised.
5.790 ------------------------------------------------------------------------------
5.791 -
5.792 -PROCEDURE Exist (
5.793 - client_value_ IN VARCHAR2 )
5.794 -IS
5.795 -BEGIN
5.796 - General_SYS.Init_Method('&LU', '&PKG', 'Exist', TRUE);
5.797 - Domain_SYS.Exist_(lu_name_, active_value_list_, client_value_);
5.798 -END Exist;
5.799 -
5.800 -
5.801 -PROCEDURE Enumerate (
5.802 - client_values_ OUT VARCHAR2)
5.803 -IS
5.804 -BEGIN
5.805 - client_values_ := Domain_SYS.Enumerate_(active_value_list_);
5.806 -END Enumerate;
5.807 -
5.808 -PROCEDURE Exist_Db (
5.809 - db_value_ IN VARCHAR2 )
5.810 -IS
5.811 -BEGIN
5.812 - General_SYS.Init_Method('&LU', '&PKG', 'Exist_Db', TRUE);
5.813 - Domain_SYS.Exist_(lu_name_, db_value_list_, db_value_);
5.814 -END Exist_Db;
5.815 -
5.816 ------------------------------------------------------------------------------
5.817 --------------------- PUBLIC DOMAIN METHODS ----------------------------------
5.818 ------------------------------------------------------------------------------
5.819 --- Encode
5.820 --- Returns the stored database representation of a domain value given the
5.821 --- client value in current language.
5.822 ---
5.823 --- Decode
5.824 --- Returns the client representation of a domain value in the
5.825 --- current client language.
5.826 ---
5.827 --- Get_Db_Value
5.828 --- Returns the database representation a domain value given its index.
5.829 ---
5.830 --- Get_Client_Value
5.831 --- Returns the client representation a domain value given its index.
5.832 ------------------------------------------------------------------------------
5.833 -
5.834 -FUNCTION Encode (
5.835 - client_value_ IN VARCHAR2 ) RETURN VARCHAR2
5.836 -IS
5.837 -BEGIN
5.838 - RETURN(Domain_SYS.Encode_(active_value_list_, db_value_list_, client_value_));
5.839 -END Encode;
5.840 -
5.841 -
5.842 -FUNCTION Decode (
5.843 - db_value_ IN VARCHAR2 ) RETURN VARCHAR2
5.844 -IS
5.845 -BEGIN
5.846 - RETURN(Domain_SYS.Decode_(active_value_list_, db_value_list_, db_value_));
5.847 -END Decode;
5.848 -
5.849 -
5.850 -FUNCTION Get_Db_Value (
5.851 - index_ IN NUMBER ) RETURN VARCHAR2
5.852 -IS
5.853 -BEGIN
5.854 - RETURN(Domain_SYS.Get_Db_Value_(db_value_list_, index_));
5.855 -END Get_Db_Value;
5.856 -
5.857 -
5.858 -FUNCTION Get_Client_Value (
5.859 - index_ IN NUMBER ) RETURN VARCHAR2
5.860 -IS
5.861 -BEGIN
5.862 - RETURN(Domain_SYS.Get_Client_Value_(active_value_list_, index_));
5.863 -END Get_Client_Value;
5.864 -
5.865 ------------------------------------------------------------------------------
5.866 --------------------- PUBLIC TRANSLATION METHODS -----------------------------
5.867 ------------------------------------------------------------------------------
5.868 -
5.869 -PROCEDURE Language_Refreshed
5.870 -IS
5.871 -BEGIN
5.872 - active_value_list_ := Language_SYS.Translate_Iid_(lu_name_, client_value_list_);
5.873 - active_state_list_ := Language_SYS.Translate_State_(lu_name_, client_state_list_);
5.874 -END Language_Refreshed;
5.875 -
5.876 ------------------------------------------------------------------------------
5.877 -------------------- LU SPECIFIC IMPLEMENTATION METHODS ---------------------
5.878 -----------------------------------------------------------------------------
5.879
5.880 @@ -885,219 +37,15 @@
5.881
5.882
5.883 -----------------------------------------------------------------------------
5.884 --------------------- SERVICE SPECIFIC IMPLEMENTATION METHODS ----------------
5.885 +-------------------- FOUNDATION1 METHODS ------------------------------------
5.886 -----------------------------------------------------------------------------
5.887
5.888 -
5.889 ------------------------------------------------------------------------------
5.890 --------------------- SERVICE SPECIFIC PRIVATE METHODS -----------------------
5.891 ------------------------------------------------------------------------------
5.892 -
5.893 -
5.894 ------------------------------------------------------------------------------
5.895 --------------------- SERVICE SPECIFIC PROTECTED METHODS ---------------------
5.896 ------------------------------------------------------------------------------
5.897 -
5.898 -
5.899 ------------------------------------------------------------------------------
5.900 --------------------- SERVICE SPECIFIC PUBLIC METHODS ------------------------
5.901 ------------------------------------------------------------------------------
5.902 -
5.903 -
5.904 ------------------------------------------------------------------------------
5.905 --------------------- FOUNDATION1 METHODS ------------------------------------
5.906 ------------------------------------------------------------------------------
5.907 --- Init
5.908 --- Dummy procedure that can be called at database startup to ensure that
5.909 --- this package is loaded into memory for performance reasons only.
5.910 ------------------------------------------------------------------------------
5.911 -
5.912 -PROCEDURE Init
5.913 -IS
5.914 -BEGIN
5.915 - NULL;
5.916 -END Init;
5.917 -
5.918 +PROCEDURE Init;
5.919
5.920 END &PKG;
5.921 /
5.922 SHOW ERROR
5.923
5.924 -undefine MODULE
5.925 -undefine LU
5.926 -undefine SERVICE
5.927 -undefine TABLE
5.928 -undefine VIEW
5.929 -undefine PKG
5.930 -undefine STATEPKG
5.931 -undefine DOMAIN
5.932 -
5.933 -undefine OBJID
5.934 -undefine OBJVERSION
5.935 -undefine OBJSTATE
5.936 -undefine OBJEVENTS
5.937 -undefine STATE
5.938 -undefine DB_VALUES
5.939 -undefine CLIENT_VALUES
5.940 -
5.941 ------------------------------------------------------------------------------
5.942 -------------------------------- STATEPACKAGE --------------------------------
5.943 ------------------------------------------------------------------------------
5.944 --- Separate Finite State Machine Package.
5.945 ------------------------------------------------------------------------------
5.946 -
5.947 -PROMPT Creating &STATEPKG implementation
5.948 -
5.949 -CREATE OR REPLACE PACKAGE BODY &STATEPKG IS
5.950 -
5.951 ------------------------------------------------------------------------------
5.952 ------------------------ STATEPACKAGE DECLARATIONS ---------------------------
5.953 ------------------------------------------------------------------------------
5.954 -
5.955 -db_state_list_ CONSTANT VARCHAR2(32000) := '&DB_STATES';
5.956 -client_state_list_ CONSTANT VARCHAR2(32000) := '&CLIENT_STATES';
5.957 -active_state_list_ VARCHAR2(32000) := Language_SYS.Translate_State_(lu_name_, client_state_list_);
5.958 -state_separator_ CONSTANT VARCHAR2(1) := Client_SYS.field_separator_;
5.959 -
5.960 ------------------------------------------------------------------------------
5.961 ---------------- LU SPECIFIC STATEPACKAGE ACTION DECLARATIONS ----------------
5.962 ------------------------------------------------------------------------------
5.963 -
5.964 ------------------------------------------------------------------------------
5.965 -------------- LU SPECIFIC STATEPACKAGE CONDITION DECLARATIONS ---------------
5.966 ------------------------------------------------------------------------------
5.967 -
5.968 ------------------------------------------------------------------------------
5.969 --------------------- IMPLEMENTATION STATEPACKAGE METHODS --------------------
5.970 ------------------------------------------------------------------------------
5.971 --- Finite_State_Set___
5.972 --- Updates the finite state indicator for an existing LU-instance.
5.973 ---
5.974 --- Finite_State_Machine___
5.975 --- Processes an event by:
5.976 --- 1. Fetching the current state
5.977 --- 2. Evaluating any conditions for given event at current state
5.978 --- 3. executing any exit code for the old state
5.979 --- 4. Performing any action associated with given event
5.980 --- 5. update the database to the new state
5.981 --- 6. execute any entry code for the new state
5.982 --- 7. Executing a state change to the new state
5.983 ------------------------------------------------------------------------------
5.984 -
5.985 -PROCEDURE Finite_State_Set___ (
5.986 - rec_ IN OUT &TABLE%ROWTYPE,
5.987 - state_ IN VARCHAR2 )
5.988 -IS
5.989 -BEGIN
5.990 - <<<FSUPDATE: Put your own SQL-statement here to set the new state>>>;
5.991 -END Finite_State_Set___;
5.992 -
5.993 -
5.994 -PROCEDURE Finite_State_Machine___ (
5.995 - rec_ IN OUT &TABLE%ROWTYPE,
5.996 - event_ IN VARCHAR2,
5.997 - attr_ IN OUT VARCHAR2 )
5.998 -IS
5.999 - state_ VARCHAR2(30);
5.1000 -BEGIN
5.1001 - <<<FSFETCH: Put your own SQL-statement here to fetch the current state>>>;
5.1002 - <<<FSEVENT: Code for processing of events>>>;
5.1003 -END Finite_State_Machine___;
5.1004 -
5.1005 ------------------------------------------------------------------------------
5.1006 --------------------- PRIVATE STATEPACKAGE METHODS ---------------------------
5.1007 ------------------------------------------------------------------------------
5.1008 --- Finite_State_Decode__
5.1009 --- Returns the client equivalent for any database representation of
5.1010 --- a state name = objstate.
5.1011 ---
5.1012 --- Finite_State_Encode__
5.1013 --- Returns the database equivalent for any client representation of
5.1014 --- a state name = state.
5.1015 ---
5.1016 --- Enumerate_States__
5.1017 --- Returns a list of all possible finite states in client terminology.
5.1018 ---
5.1019 --- Finite_State_Events__
5.1020 --- Returns a list of allowed events for a given state
5.1021 --- NOTE! Regardless of conditions if not otherwize encoded
5.1022 ---
5.1023 --- Enumerate_Events__
5.1024 --- Returns a list of all possible events.
5.1025 ------------------------------------------------------------------------------
5.1026 -
5.1027 -FUNCTION Finite_State_Decode__ (
5.1028 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2
5.1029 -IS
5.1030 -BEGIN
5.1031 - RETURN(Domain_SYS.Decode_(active_state_list_, db_state_list_, db_state_));
5.1032 -END Finite_State_Decode__;
5.1033 -
5.1034 -
5.1035 -FUNCTION Finite_State_Encode__ (
5.1036 - client_state_ IN VARCHAR2 ) RETURN VARCHAR2
5.1037 -IS
5.1038 -BEGIN
5.1039 - RETURN(Domain_SYS.Encode_(active_state_list_, db_state_list_, client_state_));
5.1040 -END Finite_State_Encode__;
5.1041 -
5.1042 -
5.1043 -PROCEDURE Enumerate_States__ (
5.1044 - client_values_ OUT VARCHAR2)
5.1045 -IS
5.1046 -BEGIN
5.1047 - client_values_ := Domain_SYS.Enumerate_(active_state_list_);
5.1048 -END Enumerate_States__;
5.1049 -
5.1050 -
5.1051 -FUNCTION Finite_State_Events__ (
5.1052 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2
5.1053 -IS
5.1054 -BEGIN
5.1055 - <<<FSEVALID: Put your code for returning valid event list here>>>;
5.1056 -END Finite_State_Events__;
5.1057 -
5.1058 -
5.1059 -PROCEDURE Enumerate_Events__ (
5.1060 - db_events_ OUT VARCHAR2 )
5.1061 -IS
5.1062 -BEGIN
5.1063 - db_events_ := '<<<FSELIST: Put your code for returning complete event list here>>>';
5.1064 -END Enumerate_Events__;
5.1065 -
5.1066 ------------------------------------------------------------------------------
5.1067 ------------------ STATEPACKAGE PUBLIC TRANSLATION METHODS -------------------
5.1068 ------------------------------------------------------------------------------
5.1069 -
5.1070 -PROCEDURE Language_Refreshed
5.1071 -IS
5.1072 -BEGIN
5.1073 - active_state_list_ := Language_SYS.Translate_State_(lu_name_, client_state_list_);
5.1074 -END Language_Refreshed;
5.1075 -
5.1076 ------------------------------------------------------------------------------
5.1077 -------------------- LU SPECIFIC STATEPACKAGE ACTIONS ------------------------
5.1078 ------------------------------------------------------------------------------
5.1079 -
5.1080 ------------------------------------------------------------------------------
5.1081 ------------------- LU SPECIFIC STATEPACKAGE CONDITIONS ----------------------
5.1082 ------------------------------------------------------------------------------
5.1083 -
5.1084 ------------------------------------------------------------------------------
5.1085 --------------------- STATEPACKAGE FOUNDATION1 METHODS -----------------------
5.1086 ------------------------------------------------------------------------------
5.1087 --- Init
5.1088 --- Dummy procedure that can be called at database startup to ensure that
5.1089 --- this package is loaded into memory for performance reasons only.
5.1090 ------------------------------------------------------------------------------
5.1091 -
5.1092 -PROCEDURE Init
5.1093 -IS
5.1094 -BEGIN
5.1095 - NULL;
5.1096 -END Init;
5.1097 -
5.1098 -
5.1099 -END &STATEPKG;
5.1100 -/
5.1101 -SHOW ERROR
5.1102 +UNDEFINE MODULE
5.1103 +UNDEFINE LU
5.1104 +UNDEFINE PKG