1.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/template.api Tue Jan 17 10:44:49 2012 +0530
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,287 +0,0 @@
1.4 ------------------------------------------------------------------------------
1.5 ---
1.6 --- Logical unit: <<<LU: Put your LU name here>>>
1.7 ---
1.8 --- IFS/Design Template Version 2.3
1.9 ---
1.10 --- Date Sign History
1.11 --- ------ ---- -----------------------------------------------------------
1.12 ------------------------------------------------------------------------------
1.13 -
1.14 -define MODULE = <<<MODULE: Put your module name here>>>
1.15 -define LU = <<<LU: Put your lu name here>>>
1.16 -define SERVICE = <<<SERVICE: Put your system service name here>>>
1.17 -define PKG = <<<PKG: Put your package name here>>>
1.18 -define DOMAIN = <<<DOMAIN: Put your domain name here>>>
1.19 -
1.20 -
1.21 -PROMPT Creating &PKG specification
1.22 -
1.23 -CREATE OR REPLACE PACKAGE &PKG IS
1.24 -
1.25 -module_ CONSTANT VARCHAR2(25) := '&MODULE';
1.26 -lu_name_ CONSTANT VARCHAR2(25) := '&LU';
1.27 -domain_ CONSTANT VARCHAR2(25) := '&DOMAIN';
1.28 -service_ CONSTANT VARCHAR2(25) := '&SERVICE';
1.29 -
1.30 -<<<PUBREC: public record definition>>>
1.31 -
1.32 ------------------------------------------------------------------------------
1.33 --------------- STATEPACKAGE: PRIVATE FINITE STATE MACHINE -------------------
1.34 ------------------------------------------------------------------------------
1.35 -
1.36 -FUNCTION Finite_State_Decode__ (
1.37 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2;
1.38 -PRAGMA restrict_references(Finite_State_Decode__, WNDS);
1.39 -
1.40 -FUNCTION Finite_State_Encode__ (
1.41 - client_state_ IN VARCHAR2 ) RETURN VARCHAR2;
1.42 -PRAGMA restrict_references(Finite_State_Encode__, WNDS);
1.43 -
1.44 -PROCEDURE Enumerate_States__ (
1.45 - client_values_ OUT VARCHAR2 );
1.46 -
1.47 -FUNCTION Finite_State_Events__ (
1.48 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2;
1.49 -PRAGMA restrict_references(Finite_State_Events__, WNDS);
1.50 -
1.51 -PROCEDURE Enumerate_Events__ (
1.52 - db_events_ OUT VARCHAR2 );
1.53 -
1.54 ------------------------------------------------------------------------------
1.55 --------------------- PRIVATE FINITE STATE MACHINE ---------------------------
1.56 ------------------------------------------------------------------------------
1.57 -
1.58 -FUNCTION Finite_State_Decode__ (
1.59 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2;
1.60 -PRAGMA restrict_references(Finite_State_Decode__, WNDS);
1.61 -
1.62 -FUNCTION Finite_State_Encode__ (
1.63 - client_state_ IN VARCHAR2 ) RETURN VARCHAR2;
1.64 -PRAGMA restrict_references(Finite_State_Encode__, WNDS);
1.65 -
1.66 -PROCEDURE Enumerate_States__ (
1.67 - client_values_ OUT VARCHAR2 );
1.68 -
1.69 -FUNCTION Finite_State_Events__ (
1.70 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2;
1.71 -PRAGMA restrict_references(Finite_State_Events__, WNDS);
1.72 -
1.73 -PROCEDURE Enumerate_Events__ (
1.74 - db_events_ OUT VARCHAR2 );
1.75 -
1.76 ------------------------------------------------------------------------------
1.77 --------------------- PRIVATE BASE METHODS -----------------------------------
1.78 ------------------------------------------------------------------------------
1.79 -
1.80 -PROCEDURE Lock__ (
1.81 - info_ OUT VARCHAR2,
1.82 - objid_ IN VARCHAR2,
1.83 - objversion_ IN VARCHAR2 );
1.84 -
1.85 -PROCEDURE New__ (
1.86 - info_ OUT VARCHAR2,
1.87 - objid_ OUT VARCHAR2,
1.88 - objversion_ OUT VARCHAR2,
1.89 - attr_ IN OUT VARCHAR2,
1.90 - action_ IN VARCHAR2 );
1.91 -
1.92 -PROCEDURE Modify__ (
1.93 - info_ OUT VARCHAR2,
1.94 - objid_ IN VARCHAR2,
1.95 - objversion_ IN OUT VARCHAR2,
1.96 - attr_ IN OUT VARCHAR2,
1.97 - action_ IN VARCHAR2 );
1.98 -
1.99 -PROCEDURE Remove__ (
1.100 - info_ OUT VARCHAR2,
1.101 - objid_ IN VARCHAR2,
1.102 - objversion_ IN VARCHAR2,
1.103 - action_ IN VARCHAR2 );
1.104 -
1.105 ------------------------------------------------------------------------------
1.106 --------------------- PUBLIC BASE METHODS ------------------------------------
1.107 ------------------------------------------------------------------------------
1.108 -
1.109 -PROCEDURE Exist (
1.110 - <<<KEYARG: Put your primary key parameters here>>> );
1.111 -
1.112 -PROCEDURE Exist_Db (
1.113 - <<<DBKARG: Put your primary key parameters here>>> );
1.114 -
1.115 ------------------------------------------------------------------------------
1.116 --------------------- PUBLIC DOMAIN METHODS ----------------------------------
1.117 ------------------------------------------------------------------------------
1.118 -
1.119 -PROCEDURE Exist (
1.120 - client_value_ IN VARCHAR2 );
1.121 -
1.122 -PROCEDURE Enumerate (
1.123 - client_values_ OUT VARCHAR2 );
1.124 -
1.125 -PROCEDURE Exist_Db (
1.126 - db_value_ IN VARCHAR2 );
1.127 -
1.128 ------------------------------------------------------------------------------
1.129 --------------------- PUBLIC DOMAIN METHODS ----------------------------------
1.130 ------------------------------------------------------------------------------
1.131 -
1.132 -FUNCTION Encode (
1.133 - client_value_ IN VARCHAR2 ) RETURN VARCHAR2;
1.134 -PRAGMA restrict_references(Encode, WNDS);
1.135 -
1.136 -FUNCTION Decode (
1.137 - db_value_ IN VARCHAR2 ) RETURN VARCHAR2;
1.138 -PRAGMA restrict_references(Decode, WNDS);
1.139 -
1.140 -FUNCTION Get_Db_Value (
1.141 - index_ IN NUMBER ) RETURN VARCHAR2;
1.142 -PRAGMA restrict_references(Get_Db_Value, WNDS);
1.143 -
1.144 -FUNCTION Get_Client_Value (
1.145 - index_ IN NUMBER ) RETURN VARCHAR2;
1.146 -PRAGMA restrict_references(Get_Client_Value, WNDS);
1.147 -
1.148 ------------------------------------------------------------------------------
1.149 --------------------- PUBLIC TRANSLATION METHODS -----------------------------
1.150 ------------------------------------------------------------------------------
1.151 -
1.152 -PROCEDURE Language_Refreshed;
1.153 -
1.154 ------------------------------------------------------------------------------
1.155 --------------------- LU SPECIFIC PRIVATE METHODS ----------------------------
1.156 ------------------------------------------------------------------------------
1.157 -
1.158 -
1.159 ------------------------------------------------------------------------------
1.160 --------------------- LU SPECIFIC PROTECTED METHODS --------------------------
1.161 ------------------------------------------------------------------------------
1.162 -
1.163 -
1.164 ------------------------------------------------------------------------------
1.165 --------------------- LU SPECIFIC PUBLIC METHODS -----------------------------
1.166 ------------------------------------------------------------------------------
1.167 -
1.168 -
1.169 ------------------------------------------------------------------------------
1.170 --------------------- SERVICE SPECIFIC PRIVATE METHODS -----------------------
1.171 ------------------------------------------------------------------------------
1.172 -
1.173 -
1.174 ------------------------------------------------------------------------------
1.175 --------------------- SERVICE SPECIFIC PROTECTED METHODS ---------------------
1.176 ------------------------------------------------------------------------------
1.177 -
1.178 -
1.179 ------------------------------------------------------------------------------
1.180 --------------------- SERVICE SPECIFIC PUBLIC METHODS ------------------------
1.181 ------------------------------------------------------------------------------
1.182 -
1.183 -
1.184 ------------------------------------------------------------------------------
1.185 --------------------- FOUNDATION1 METHODS ------------------------------------
1.186 ------------------------------------------------------------------------------
1.187 -
1.188 -PROCEDURE Init;
1.189 -
1.190 -
1.191 -END &PKG;
1.192 -/
1.193 -SHOW ERROR
1.194 -
1.195 -undefine MODULE
1.196 -undefine LU
1.197 -undefine SERVICE
1.198 -undefine PKG
1.199 -undefine DOMAIN
1.200 -
1.201 ------------------------------------------------------------------------------
1.202 ------------------------------ STATEPACKAGE ----------------------------------
1.203 ------------------------------------------------------------------------------
1.204 --- Separate Finite State Machine Package
1.205 ------------------------------------------------------------------------------
1.206 -
1.207 -define VIEW = <<<VIEW: Put your view name here>>>
1.208 -define STATEPKG = <<<STATEPKG: Put your statepackage name here>>>
1.209 -
1.210 -define OBJID = <<<OBJID: Put your object key (or rowid) here>>>
1.211 -define OBJVERSION = <<<OBJVER: Put your objversion column (or list) here>>>
1.212 -define OBJSTATE = <<<OBJSTA: Put your object state column here>>>
1.213 -define OBJEVENTS = <<<OBJEVE: Put your object events column here>>>
1.214 -define STATE = <<<STATE: Put your encoded object state column here>>>
1.215 -
1.216 -
1.217 -PROMPT Creating &VIEW view
1.218 -
1.219 -CREATE OR REPLACE VIEW &VIEW AS
1.220 -SELECT <<<VIEWCOL: Put your view column here>>>
1.221 -FROM <<<VIEWTAB: Put your view table(s) here>>>
1.222 -WHERE <<<VIEWSEC: Put your security restrictions on rows here>>>
1.223 -WITH read only;
1.224 -
1.225 -
1.226 -
1.227 -PROMPT Creating &STATEPKG specification
1.228 -
1.229 -CREATE OR REPLACE PACKAGE &STATEPKG IS
1.230 -
1.231 -module_ CONSTANT VARCHAR2(25) := '&MODULE';
1.232 -lu_name_ CONSTANT VARCHAR2(25) := '&LU';
1.233 -
1.234 ------------------------------------------------------------------------------
1.235 ----------------- STATEPACKAGE IMPLEMENTATION METHODS ------------------------
1.236 ------------------------------------------------------------------------------
1.237 -
1.238 -PROCEDURE Finite_State_Machine___ (
1.239 - rec_ IN OUT &VIEW%ROWTYPE,
1.240 - event_ IN VARCHAR2,
1.241 - attr_ IN OUT VARCHAR2 );
1.242 -
1.243 ------------------------------------------------------------------------------
1.244 --------------------- STATEPACKAGE PRIVATE METHODS ---------------------------
1.245 ------------------------------------------------------------------------------
1.246 -
1.247 -FUNCTION Finite_State_Decode__ (
1.248 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2;
1.249 -PRAGMA restrict_references(Finite_State_Decode__, WNDS);
1.250 -
1.251 -FUNCTION Finite_State_Encode__ (
1.252 - client_state_ IN VARCHAR2 ) RETURN VARCHAR2;
1.253 -PRAGMA restrict_references(Finite_State_Encode__, WNDS);
1.254 -
1.255 -PROCEDURE Enumerate_States__ (
1.256 - client_values_ OUT VARCHAR2);
1.257 -
1.258 -FUNCTION Finite_State_Events__ (
1.259 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2;
1.260 -PRAGMA restrict_references(Finite_State_Events__, WNDS);
1.261 -
1.262 -PROCEDURE Enumerate_Events__ (
1.263 - db_events_ OUT VARCHAR2 );
1.264 -
1.265 ------------------------------------------------------------------------------
1.266 ------------------- STATEPACKAGE TRANSLATION METHODS -------------------------
1.267 ------------------------------------------------------------------------------
1.268 -
1.269 -PROCEDURE Language_Refreshed;
1.270 -
1.271 ------------------------------------------------------------------------------
1.272 -------------------- STATEPACKAGE FOUNDATION1 METHODS ------------------------
1.273 ------------------------------------------------------------------------------
1.274 -
1.275 -PROCEDURE Init;
1.276 -
1.277 -
1.278 -END &STATEPKG;
1.279 -/
1.280 -SHOW ERROR
1.281 -
1.282 -undefine VIEW
1.283 -undefine STATEPKG
1.284 -
1.285 -undefine OBJID
1.286 -undefine OBJVERSION
1.287 -undefine OBJSTATE
1.288 -undefine OBJEVENTS
1.289 -undefine STATE
1.290 -
2.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/template.apy Tue Jan 17 10:44:49 2012 +0530
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,1103 +0,0 @@
2.4 ------------------------------------------------------------------------------
2.5 ---
2.6 --- Logical unit: <<<LU: Put your LU name here>>>
2.7 ---
2.8 --- Purpose:
2.9 ---
2.10 --- IFS/Design Template Version 2.3
2.11 ---
2.12 --- Date Sign History
2.13 --- ------ ---- -----------------------------------------------------------
2.14 ------------------------------------------------------------------------------
2.15 -
2.16 -define MODULE = <<<MODULE: Put your module name here>>>
2.17 -define LU = <<<LU: Put your lu name here>>>
2.18 -define SERVICE = <<<SERVICE: Put your system service name here>>>
2.19 -define TABLE = <<<TABLE: Put your TABLE name here>>>
2.20 -define VIEW = <<<VIEW: Put your view name here>>>
2.21 -define PKG = <<<PKG: Put your package name here>>>
2.22 -define STATEPKG = <<<STATEPKG: Put your statepackage name here>>>
2.23 -define DOMAIN = <<<DOMAIN: Put your domain name here>>>
2.24 -
2.25 -define OBJID = <<<OBJID: Put your object key (or rowid) here>>>
2.26 -define OBJVERSION = <<<OBJVER: Put your objversion column (or list) here>>>
2.27 -define OBJSTATE = <<<OBJSTA: Put your object state column here>>>
2.28 -define OBJEVENTS = <<<OBJEVE: Put your object events column here>>>
2.29 -define STATE = <<<STATE: Put your encoded object state column here>>>
2.30 -define DB_VALUES = <<<DBVAL: Put your database stored domain values here>>>
2.31 -define CLIENT_VALUES = <<<PROGVAL: Put your client PROG domain values here>>>
2.32 -
2.33 ------------------------------------------------------------------------------
2.34 --------------------- VIEWS FOR SELECTS --------------------------------------
2.35 ------------------------------------------------------------------------------
2.36 -
2.37 -PROMPT Creating &VIEW view
2.38 -
2.39 -CREATE OR REPLACE VIEW &VIEW AS
2.40 -SELECT <<<VIEWCOL: Put your view column here>>>
2.41 -FROM <<<VIEWTAB: Put your view table(s) here>>>
2.42 -WHERE <<<VIEWSEC: Put your security restrictions on rows here>>>
2.43 -WITH read only;
2.44 -
2.45 ------------------------------------------------------------------------------
2.46 --------------------- PACKAGES FOR METHODS -----------------------------------
2.47 ------------------------------------------------------------------------------
2.48 -
2.49 -PROMPT Creating &PKG implementation
2.50 -
2.51 -CREATE OR REPLACE PACKAGE BODY &PKG IS
2.52 -
2.53 ------------------------------------------------------------------------------
2.54 --------------------- DOMAIN DECLARATIONS ------------------------------------
2.55 ------------------------------------------------------------------------------
2.56 -
2.57 -db_value_list_ CONSTANT VARCHAR2(<<<DBLENGTH: Length of db_value_list_>>>) := '&DB_VALUES';
2.58 -client_value_list_ CONSTANT VARCHAR2(<<<CLENGTH: Length of client_value_list_>>>) := '&CLIENT_VALUES';
2.59 -active_value_list_ VARCHAR2(<<<ALENGTH: Length of active_value_list_>>>) := Language_SYS.Translate_Iid_(lu_name_, client_value_list_);
2.60 -
2.61 ------------------------------------------------------------------------------
2.62 --------------------- FINITE STATE DECLARATIONS ------------------------------
2.63 ------------------------------------------------------------------------------
2.64 -
2.65 -db_state_list_ CONSTANT VARCHAR2(<<<DBSTATEL: Length of db_state_list_>>>) := '&DB_STATES';
2.66 -client_state_list_ CONSTANT VARCHAR2(<<<CSTATEL: Length of client_state_list_>>>) := '&CLIENT_STATES';
2.67 -active_state_list_ VARCHAR2(<<<ASTATEL: Length of active_state_list_>>>) := Language_SYS.Translate_State_(lu_name_, client_state_list_);
2.68 -state_separator_ CONSTANT VARCHAR2(1) := Client_SYS.field_separator_;
2.69 -
2.70 ------------------------------------------------------------------------------
2.71 --------------------- LU SPECIFIC IMPLEMENTATION METHOD DECLARATIONS ---------
2.72 ------------------------------------------------------------------------------
2.73 -
2.74 -
2.75 ------------------------------------------------------------------------------
2.76 --------------------- SERVICE SPECIFIC IMPLEMENTATION METHOD DECLARATIONS ----
2.77 ------------------------------------------------------------------------------
2.78 -
2.79 -
2.80 ------------------------------------------------------------------------------
2.81 --------------------- IMPLEMENTATION BASE METHODS ----------------------------
2.82 ------------------------------------------------------------------------------
2.83 --- Lock_By_Id___
2.84 --- Client-support to lock a specific instance of the logical unit.
2.85 ---
2.86 --- Lock_By_Keys___
2.87 --- Server support to lock a specific instance of the logical unit.
2.88 ---
2.89 --- Get_Object_By_Id___
2.90 --- Get LU-record from the database with a specified object identity.
2.91 ---
2.92 --- Get_Object_By_Keys___
2.93 --- Get LU-record from the database with specified key columns.
2.94 ---
2.95 --- Check_Exist___
2.96 --- Check if a specific LU-instance already exist in the database.
2.97 ---
2.98 --- Get_Id_Version_By_Keys___
2.99 --- Get the current OBJID and OBJVERSION for a specific LU-instance.
2.100 ------------------------------------------------------------------------------
2.101 -
2.102 -FUNCTION Lock_By_Id___ (
2.103 - objid_ IN VARCHAR2,
2.104 - objversion_ IN VARCHAR2 ) RETURN &TABLE%ROWTYPE
2.105 -IS
2.106 - row_changed EXCEPTION;
2.107 - row_deleted EXCEPTION;
2.108 - row_locked EXCEPTION;
2.109 - PRAGMA exception_init(row_locked, -0054);
2.110 - rec_ &TABLE%ROWTYPE;
2.111 - dummy_ NUMBER;
2.112 - CURSOR lock_control IS
2.113 - SELECT *
2.114 - FROM &TABLE
2.115 - WHERE &OBJID = objid_
2.116 - AND &OBJVERSION = objversion_
2.117 - FOR UPDATE NOWAIT;
2.118 - CURSOR exist_control IS
2.119 - SELECT 1
2.120 - FROM &TABLE
2.121 - WHERE &OBJID = objid_;
2.122 -BEGIN
2.123 - OPEN lock_control;
2.124 - FETCH lock_control INTO rec_;
2.125 - IF (lock_control%FOUND) THEN
2.126 - CLOSE lock_control;
2.127 - RETURN rec_;
2.128 - END IF;
2.129 - CLOSE lock_control;
2.130 - OPEN exist_control;
2.131 - FETCH exist_control INTO dummy_;
2.132 - IF (exist_control%FOUND) THEN
2.133 - CLOSE exist_control;
2.134 - RAISE row_changed;
2.135 - ELSE
2.136 - CLOSE exist_control;
2.137 - RAISE row_deleted;
2.138 - END IF;
2.139 -EXCEPTION
2.140 - WHEN row_locked THEN
2.141 - Error_SYS.Record_Locked(lu_name_);
2.142 - WHEN row_changed THEN
2.143 - Error_SYS.Record_Modified(lu_name_);
2.144 - WHEN row_deleted THEN
2.145 - Error_SYS.Record_Removed(lu_name_);
2.146 -END Lock_By_Id___;
2.147 -
2.148 -FUNCTION Lock_By_Keys___ (
2.149 - <<<DBKARG: Put your primary key parameters here>>> ) RETURN &TABLE%ROWTYPE
2.150 -IS
2.151 - row_deleted EXCEPTION;
2.152 - rec_ &TABLE%ROWTYPE;
2.153 - CURSOR lock_control IS
2.154 - SELECT *
2.155 - FROM &TABLE
2.156 - WHERE <<<KEYWH2: Put your primary key condition here>>>
2.157 - FOR UPDATE;
2.158 -BEGIN
2.159 - OPEN lock_control;
2.160 - FETCH lock_control INTO rec_;
2.161 - IF (lock_control%FOUND) THEN
2.162 - CLOSE lock_control;
2.163 - RETURN rec_;
2.164 - ELSE
2.165 - CLOSE lock_control;
2.166 - RAISE row_deleted;
2.167 - END IF;
2.168 -EXCEPTION
2.169 - WHEN row_deleted THEN
2.170 - Error_SYS.Record_Removed(lu_name_);
2.171 -END Lock_By_Keys___;
2.172 -
2.173 -FUNCTION Get_Object_By_Id___ (
2.174 - objid_ IN VARCHAR2 ) RETURN &TABLE%ROWTYPE
2.175 -IS
2.176 - lu_rec_ &TABLE%ROWTYPE;
2.177 - CURSOR getrec IS
2.178 - SELECT *
2.179 - FROM &TABLE
2.180 - WHERE &OBJID = objid_;
2.181 -BEGIN
2.182 - OPEN getrec;
2.183 - FETCH getrec INTO lu_rec_;
2.184 - IF (getrec%NOTFOUND) THEN
2.185 - CLOSE getrec;
2.186 - Error_SYS.Record_Removed(lu_name_);
2.187 - END IF;
2.188 - CLOSE getrec;
2.189 - RETURN(lu_rec_);
2.190 -END Get_Object_By_Id___;
2.191 -
2.192 -
2.193 -FUNCTION Get_Object_By_Keys___ (
2.194 - <<<DBKARG: Put your primary key parameters here>>> ) RETURN &TABLE%ROWTYPE
2.195 -IS
2.196 - lu_rec_ &TABLE%ROWTYPE;
2.197 - CURSOR getrec IS
2.198 - SELECT *
2.199 - FROM &TABLE
2.200 - WHERE <<<KEYWH2: Put your primary key condition here>>>;
2.201 -BEGIN
2.202 - OPEN getrec;
2.203 - FETCH getrec INTO lu_rec_;
2.204 - CLOSE getrec;
2.205 - RETURN(lu_rec_);
2.206 -END Get_Object_By_Keys___;
2.207 -
2.208 -FUNCTION Check_Exist___ (
2.209 - <<<DBKARG: Put your primary key parameters here>>> ) RETURN BOOLEAN
2.210 -IS
2.211 - dummy_ NUMBER;
2.212 - CURSOR exist_control IS
2.213 - SELECT 1
2.214 - FROM &TABLE
2.215 - WHERE <<<KEYWH2: Put your primary key condition here>>>;
2.216 -BEGIN
2.217 - OPEN exist_control;
2.218 - FETCH exist_control INTO dummy_;
2.219 - IF (exist_control%FOUND) THEN
2.220 - CLOSE exist_control;
2.221 - RETURN(TRUE);
2.222 - END IF;
2.223 - CLOSE exist_control;
2.224 - RETURN(FALSE);
2.225 -END Check_Exist___;
2.226 -
2.227 -PROCEDURE Get_Id_Version_By_Keys___ (
2.228 - objid_ IN OUT VARCHAR2,
2.229 - objversion_ IN OUT VARCHAR2,
2.230 - <<<DBKARG: Put your primary key parameters here>>>)
2.231 -IS
2.232 - CURSOR get_version IS
2.233 - SELECT &OBJID, &OBJVERSION
2.234 - FROM &TABLE
2.235 - WHERE <<<KEYWH2: Put your primary key condition here>>>;
2.236 -BEGIN
2.237 - OPEN get_version;
2.238 - FETCH get_version INTO objid_, objversion_;
2.239 - CLOSE get_version;
2.240 -END Get_Id_Version_By_Keys___;
2.241 -
2.242 ------------------------------------------------------------------------------
2.243 ------------- STATEPACKAGE: IMPLEMENTATION FINITE STATE MACHINE --------------
2.244 ------------------------------------------------------------------------------
2.245 --- This set of Implementation Finite State Machine methods should be used if
2.246 --- a separate package is used for the Finite State Machine implementation.
2.247 ---
2.248 --- Finite_State_Machine___
2.249 --- Redirect call to separate Finite State Machine Package
2.250 ---
2.251 --- Finite_State_Add_To_Attr___
2.252 --- Adds the current state and allowed events to the attribute string.
2.253 ---
2.254 --- Finite_State_Init___
2.255 --- Sets the initial finite state indicator for an existing LU-instance
2.256 --- and processes any automatic events.
2.257 ------------------------------------------------------------------------------
2.258 -
2.259 -PROCEDURE Finite_State_Machine___ (
2.260 - rec_ IN OUT &TABLE%ROWTYPE,
2.261 - event_ IN VARCHAR2,
2.262 - attr_ IN OUT VARCHAR2 )
2.263 -IS
2.264 -BEGIN
2.265 - &STATEPKG..Finite_State_Machine___(rec_, event_, attr_);
2.266 -END Finite_State_Machine___;
2.267 -
2.268 -
2.269 -PROCEDURE Finite_State_Add_To_Attr___ (
2.270 - rec_ IN &TABLE%ROWTYPE,
2.271 - attr_ IN OUT VARCHAR2 )
2.272 -IS
2.273 - state_ VARCHAR2(30);
2.274 -BEGIN
2.275 - <<<FSFETCH: Put your own SQL-statement here to fetch the current state>>>;
2.276 - Client_SYS.Add_To_Attr('__OBJSTATE', state_, attr_);
2.277 - Client_SYS.Add_To_Attr('__OBJEVENTS', Finite_State_Events__(state_), attr_);
2.278 - Client_SYS.Add_To_Attr('STATE', Finite_State_Decode__(state_), attr_);
2.279 -END Finite_State_Add_To_Attr___;
2.280 -
2.281 -
2.282 -PROCEDURE Finite_State_Init___ (
2.283 - rec_ IN OUT &TABLE%ROWTYPE,
2.284 - attr_ IN OUT VARCHAR2 )
2.285 -IS
2.286 - state_ VARCHAR2(30);
2.287 -BEGIN
2.288 - Finite_State_Machine___(rec_, NULL, attr_);
2.289 - Finite_State_Add_To_Attr___(rec_, attr_);
2.290 -END Finite_State_Init___;
2.291 -
2.292 ------------------------------------------------------------------------------
2.293 --------------------- IMPLEMENTATION FINITE STATE MACHINE --------------------
2.294 ------------------------------------------------------------------------------
2.295 --- Finite_State_Set___
2.296 --- Updates the finite state indicator for an existing LU-instance.
2.297 ---
2.298 --- Finite_State_Machine___
2.299 --- Processes an event by:
2.300 --- 1. Fetching the current state
2.301 --- 2. Evaluating any conditions for given event at current state
2.302 --- 3. executing any exit code for the old state
2.303 --- 4. Performing any action associated with given event
2.304 --- 5. update the database to the new state
2.305 --- 6. execute any entry code for the new state
2.306 --- 7. Executing a state change to the new state
2.307 ---
2.308 --- Finite_State_Add_To_Attr___
2.309 --- Adds the current state and allowed events to the attribute string.
2.310 ---
2.311 --- Finite_State_Init___
2.312 --- Sets the initial finite state indicator for an existing LU-instance
2.313 --- and processes any automatic events.
2.314 ------------------------------------------------------------------------------
2.315 -
2.316 -PROCEDURE Finite_State_Set___ (
2.317 - rec_ IN OUT &TABLE%ROWTYPE,
2.318 - state_ IN VARCHAR2 )
2.319 -IS
2.320 -BEGIN
2.321 - <<<FSUPDATE: Put your own SQL-statement here to set the new state>>>;
2.322 -END Finite_State_Set___;
2.323 -
2.324 -
2.325 -PROCEDURE Finite_State_Machine___ (
2.326 - rec_ IN OUT &TABLE%ROWTYPE,
2.327 - event_ IN VARCHAR2,
2.328 - attr_ IN OUT VARCHAR2 )
2.329 -IS
2.330 - state_ VARCHAR2(30);
2.331 -BEGIN
2.332 - <<<FSFETCH: Put your own SQL-statement here to fetch the current state>>>;
2.333 - <<<FSEVENT: Code for processing of events>>>;
2.334 -END Finite_State_Machine___;
2.335 -
2.336 -
2.337 -PROCEDURE Finite_State_Add_To_Attr___ (
2.338 - rec_ IN &TABLE%ROWTYPE,
2.339 - attr_ IN OUT VARCHAR2 )
2.340 -IS
2.341 - state_ VARCHAR2(30);
2.342 -BEGIN
2.343 - <<<FSFETCH: Put your own SQL-statement here to fetch the current state>>>;
2.344 - Client_SYS.Add_To_Attr('__OBJSTATE', state_, attr_);
2.345 - Client_SYS.Add_To_Attr('__OBJEVENTS', Finite_State_Events__(state_), attr_);
2.346 - Client_SYS.Add_To_Attr('STATE', Finite_State_Decode__(state_), attr_);
2.347 -END Finite_State_Add_To_Attr___;
2.348 -
2.349 -
2.350 -PROCEDURE Finite_State_Init___ (
2.351 - rec_ IN OUT &TABLE%ROWTYPE,
2.352 - attr_ IN OUT VARCHAR2 )
2.353 -IS
2.354 - state_ VARCHAR2(30);
2.355 -BEGIN
2.356 - Finite_State_Machine___(rec_, NULL, attr_);
2.357 - Finite_State_Add_To_Attr___(rec_, attr_);
2.358 -END Finite_State_Init___;
2.359 -
2.360 ------------------------------------------------------------------------------
2.361 --------------- STATEPACKAGE: PRIVATE FINITE STATE MACHINE -------------------
2.362 ------------------------------------------------------------------------------
2.363 --- This set of Private Finite State Machine methods should be used if a
2.364 --- separate package is used for the Finite State Machine implementation.
2.365 ---
2.366 --- Finite_State_Decode__
2.367 --- Redirect call to separate Finite State Machine Package
2.368 ---
2.369 --- Finite_State_Encode__
2.370 --- Redirect call to separate Finite State Machine Package
2.371 ---
2.372 --- Enumerate_States__
2.373 --- Redirect call to separate Finite State Machine Package
2.374 ---
2.375 --- Finite_State_Events__
2.376 --- Redirect call to separate Finite State Machine Package
2.377 ---
2.378 --- Enumerate_Events__
2.379 --- Redirect call to separate Finite State Machine Package
2.380 ------------------------------------------------------------------------------
2.381 -
2.382 -FUNCTION Finite_State_Decode__ (
2.383 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2
2.384 -IS
2.385 -BEGIN
2.386 - RETURN(&STATEPKG..Finite_State_Decode__(db_state_));
2.387 -END Finite_State_Decode__;
2.388 -
2.389 -
2.390 -FUNCTION Finite_State_Encode__ (
2.391 - client_state_ IN VARCHAR2 ) RETURN VARCHAR2
2.392 -IS
2.393 -BEGIN
2.394 - RETURN(&STATEPKG..Finite_State_Encode__(client_state_));
2.395 -END Finite_State_Encode__;
2.396 -
2.397 -
2.398 -PROCEDURE Enumerate_States__ (
2.399 - client_values_ OUT VARCHAR2 )
2.400 -IS
2.401 -BEGIN
2.402 - &STATEPKG..Enumerate_States__(client_values_);
2.403 -END Enumerate_States__;
2.404 -
2.405 -
2.406 -FUNCTION Finite_State_Events__ (
2.407 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2
2.408 -IS
2.409 -BEGIN
2.410 - RETURN(&STATEPKG..Finite_State_Events__(db_state_));
2.411 -END Finite_State_Events__;
2.412 -
2.413 -
2.414 -PROCEDURE Enumerate_Events__ (
2.415 - db_events_ OUT VARCHAR2 )
2.416 -IS
2.417 -BEGIN
2.418 - &STATEPKG..Enumerate_Events__(db_events_);
2.419 -END Enumerate_Events__;
2.420 -
2.421 ------------------------------------------------------------------------------
2.422 --------------------- PRIVATE FINITE STATE MACHINE ---------------------------
2.423 ------------------------------------------------------------------------------
2.424 --- Finite_State_Decode__
2.425 --- Returns the client equivalent for any database representation of
2.426 --- a state name = objstate.
2.427 ---
2.428 --- Finite_State_Encode__
2.429 --- Returns the database equivalent for any client representation of
2.430 --- a state name = state.
2.431 ---
2.432 --- Enumerate_States__
2.433 --- Returns a list of all possible finite states in client terminology.
2.434 ---
2.435 --- Finite_State_Events__
2.436 --- Returns a list of allowed events for a given state
2.437 --- NOTE! Regardless of conditions if not otherwize encoded
2.438 ---
2.439 --- Enumerate_Events__
2.440 --- Returns a list of all possible events.
2.441 ------------------------------------------------------------------------------
2.442 -
2.443 -FUNCTION Finite_State_Decode__ (
2.444 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2
2.445 -IS
2.446 -BEGIN
2.447 - RETURN(Domain_SYS.Decode_(active_state_list_, db_state_list_, db_state_));
2.448 -END Finite_State_Decode__;
2.449 -
2.450 -
2.451 -FUNCTION Finite_State_Encode__ (
2.452 - client_state_ IN VARCHAR2 ) RETURN VARCHAR2
2.453 -IS
2.454 -BEGIN
2.455 - RETURN(Domain_SYS.Encode_(active_state_list_, db_state_list_, client_state_));
2.456 -END Finite_State_Encode__;
2.457 -
2.458 -
2.459 -PROCEDURE Enumerate_States__ (
2.460 - client_values_ OUT VARCHAR2)
2.461 -IS
2.462 -BEGIN
2.463 - client_values_ := Domain_SYS.Enumerate_(active_state_list_);
2.464 -END Enumerate_States__;
2.465 -
2.466 -
2.467 -FUNCTION Finite_State_Events__ (
2.468 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2
2.469 -IS
2.470 -BEGIN
2.471 - <<<FSEVALID: Put your code for returning valid event list here>>>;
2.472 -END Finite_State_Events__;
2.473 -
2.474 -
2.475 -PROCEDURE Enumerate_Events__ (
2.476 - db_events_ OUT VARCHAR2 )
2.477 -IS
2.478 -BEGIN
2.479 - db_events_ := '<<<FSELIST: Put your code for returning complete event list here>>>';
2.480 -END Enumerate_Events__;
2.481 -
2.482 ------------------------------------------------------------------------------
2.483 --------------------- IMPLEMENTATION BASE METHODS FOR INSERT -----------------
2.484 ------------------------------------------------------------------------------
2.485 --- Prepare_Insert___
2.486 --- Set all default values for a new instance (ON-NEW-RECORD) of this
2.487 --- logical unit by calling procedure Add_Attr.
2.488 ---
2.489 --- Unpack_Check_Insert___
2.490 --- Unpack the attribute list, check all attributes from the client
2.491 --- and generate all default values before creation of the new object.
2.492 ---
2.493 --- Insert___
2.494 --- Insert a new LU-instance into the database and return the values
2.495 --- for OBJID and OBJVERSION.
2.496 ------------------------------------------------------------------------------
2.497 -
2.498 -PROCEDURE Prepare_Insert___ (
2.499 - attr_ IN OUT VARCHAR2 )
2.500 -IS<<<PRPBD1: Declare a temp variable if needed>>>
2.501 -BEGIN
2.502 - <<<PRPBDY: Put the call to the superclass here>>>;
2.503 -END Prepare_Insert___;
2.504 -
2.505 -
2.506 -PROCEDURE Unpack_Check_Insert___ (
2.507 - attr_ IN OUT VARCHAR2,
2.508 - newrec_ IN OUT &TABLE%ROWTYPE )
2.509 -IS
2.510 - ptr_ NUMBER;
2.511 - name_ VARCHAR2(30);
2.512 - value_ VARCHAR2(2000);
2.513 -BEGIN
2.514 - <<<UCIBDY: Put your code here to unpack and do all checkings needed before insert>>>;
2.515 -EXCEPTION
2.516 - WHEN value_error THEN
2.517 - Error_SYS.Item_Format(lu_name_, name_, value_);
2.518 -END Unpack_Check_Insert___;
2.519 -
2.520 -
2.521 -PROCEDURE Insert___ (
2.522 - objid_ OUT VARCHAR2,
2.523 - objversion_ OUT VARCHAR2,
2.524 - newrec_ IN OUT &TABLE%ROWTYPE,
2.525 - attr_ IN OUT VARCHAR2 )
2.526 -IS
2.527 -BEGIN
2.528 - <<<SETVER2: Code for setting the rowversion>>>
2.529 - <<<INSERT: Put your own SQL-statement here to insert the new record>>>;
2.530 - Finite_State_Init___(newrec_, attr_);
2.531 -EXCEPTION
2.532 - WHEN dup_val_on_index THEN
2.533 - Error_SYS.Record_Exist(lu_name_);
2.534 -END Insert___;
2.535 -
2.536 ------------------------------------------------------------------------------
2.537 --------------------- IMPLEMENTATION BASE METHODS FOR UPDATE -----------------
2.538 ------------------------------------------------------------------------------
2.539 --- Unpack_Check_Update___
2.540 --- Unpack the attribute list, check all attributes from the client
2.541 --- and generate all default values before modifying the object.
2.542 ---
2.543 --- Update___
2.544 --- Update an existing LU-instance in the database and return the
2.545 --- the new OBJVERSION.
2.546 ------------------------------------------------------------------------------
2.547 -
2.548 -PROCEDURE Unpack_Check_Update___ (
2.549 - attr_ IN OUT VARCHAR2,
2.550 - newrec_ IN OUT &TABLE%ROWTYPE,
2.551 - objid_ IN VARCHAR2 )
2.552 -IS
2.553 - ptr_ NUMBER;
2.554 - name_ VARCHAR2(30);
2.555 - value_ VARCHAR2(2000);
2.556 -BEGIN
2.557 - <<<UCUBDY: Put your code here to unpack and do all checkings needed before update>>>;
2.558 -EXCEPTION
2.559 - WHEN value_error THEN
2.560 - Error_SYS.Item_Format(lu_name_, name_, value_);
2.561 -END Unpack_Check_Update___;
2.562 -
2.563 -
2.564 -PROCEDURE Update___ (
2.565 - objid_ IN VARCHAR2,
2.566 - oldrec_ IN &TABLE%ROWTYPE,
2.567 - newrec_ IN OUT &TABLE%ROWTYPE,
2.568 - attr_ IN OUT VARCHAR2,
2.569 - objversion_ IN OUT VARCHAR2,
2.570 - by_keys_ IN BOOLEAN DEFAULT FALSE )
2.571 -IS
2.572 -BEGIN
2.573 - <<<SETVER: Code for setting the rowversion>>>
2.574 - IF by_keys_ THEN
2.575 - <<<UPDATE: Put your own SQL-statement here to update the new record>>>
2.576 - WHERE <<<RECWHR: Put your primary key condition here>>>;
2.577 - ELSE
2.578 - <<<UPDATE: Put your own SQL-statement here to update the new record>>>
2.579 - WHERE &OBJID = objid_;
2.580 - END IF;
2.581 -EXCEPTION
2.582 - WHEN dup_val_on_index THEN
2.583 - Error_SYS.Record_Exist(lu_name_);
2.584 -END Update___;
2.585 -
2.586 ------------------------------------------------------------------------------
2.587 --------------------- IMPLEMENTATION BASE METHODS FOR DELETE -----------------
2.588 ------------------------------------------------------------------------------
2.589 --- Check_Delete___
2.590 --- Checks whether a specific LU-record may be removed or not.
2.591 --- The procedure should check business rules like attribute values
2.592 --- as well as database constraints (defined or not).
2.593 ---
2.594 --- Delete___
2.595 --- Deletion of the specific LU-object from the database.
2.596 ------------------------------------------------------------------------------
2.597 -
2.598 -PROCEDURE Check_Delete___ (
2.599 - remrec_ IN &TABLE%ROWTYPE )
2.600 -IS
2.601 - key_ VARCHAR2(2000);
2.602 -BEGIN
2.603 - key_ := <<<KEYCAT: Put your primary keys here>>>;
2.604 - Reference_SYS.Check_Restricted_Delete(lu_name_, key_);
2.605 -END Check_Delete___;
2.606 -
2.607 -
2.608 -PROCEDURE Delete___ (
2.609 - objid_ IN VARCHAR2,
2.610 - remrec_ IN &TABLE%ROWTYPE )
2.611 -IS
2.612 - key_ VARCHAR2(2000);
2.613 -BEGIN
2.614 - key_ := <<<KEYCAT: Put your primary keys here>>>;
2.615 - Reference_SYS.Do_Cascade_Delete(lu_name_, key_);
2.616 - <<<DELETE: Put your own SQL-statement here to delete the old record>>>;
2.617 -END Delete___;
2.618 -
2.619 ------------------------------------------------------------------------------
2.620 --------------------- PRIVATE BASE METHODS -----------------------------------
2.621 ------------------------------------------------------------------------------
2.622 --- Lock__
2.623 --- Client-support to lock a specific instance of the logical unit.
2.624 ---
2.625 --- New__
2.626 --- Client-support interface to create LU instances.
2.627 --- action_ = 'PREPARE'
2.628 --- Default values and handle of information to client.
2.629 --- The default values are set in procedure Prepare_Insert___.
2.630 --- action_ = 'CHECK'
2.631 --- Check all attributes before creating new object and handle of
2.632 --- information to client. The attribute list is unpacked, checked
2.633 --- and prepared (defaults) in procedure Unpack_Check_Insert___.
2.634 --- action_ = 'DO'
2.635 --- Creation of new instances of the logical unit and handle of
2.636 --- information to client. The attribute list is unpacked, checked
2.637 --- and prepared (defaults) in procedure Unpack_Check_Insert___
2.638 --- before calling procedure Insert___.
2.639 ---
2.640 --- Modify__
2.641 --- Client-support interface to modify attributes for LU instances.
2.642 --- action_ = 'CHECK'
2.643 --- Check all attributes before modifying an existing object and
2.644 --- handle of information to client. The attribute list is unpacked,
2.645 --- checked and prepared(defaults) in procedure Unpack_Check_Update___.
2.646 --- action_ = 'DO'
2.647 --- Modification of an existing instance of the logical unit. The
2.648 --- procedure unpacks the attributes, checks all values before
2.649 --- procedure Update___ is called.
2.650 ---
2.651 --- Remove__
2.652 --- Client-support interface to remove LU instances.
2.653 --- action_ = 'CHECK'
2.654 --- Check whether a specific LU-instance may be removed or not.
2.655 --- The procedure fetches the complete record by calling procedure
2.656 --- Get_Object_By_Id___. Then the check is made by calling procedure
2.657 --- Check_Delete___.
2.658 --- action_ = 'DO'
2.659 --- Remove an existing instance of the logical unit. The procedure
2.660 --- fetches the complete LU-record, checks for a delete and then
2.661 --- deletes the record by calling procedure Delete___.
2.662 ------------------------------------------------------------------------------
2.663 -
2.664 -PROCEDURE Lock__ (
2.665 - info_ OUT VARCHAR2,
2.666 - objid_ IN VARCHAR2,
2.667 - objversion_ IN VARCHAR2 )
2.668 -IS
2.669 - dummy_ &TABLE%ROWTYPE;
2.670 -BEGIN
2.671 - General_SYS.Init_Method(lu_name_, '&PKG', 'Lock__');
2.672 - dummy_ := Lock_By_Id___(objid_, objversion_);
2.673 - info_ := Client_SYS.Get_All_Info;
2.674 -END Lock__;
2.675 -
2.676 -
2.677 -PROCEDURE New__ (
2.678 - info_ OUT VARCHAR2,
2.679 - objid_ OUT VARCHAR2,
2.680 - objversion_ OUT VARCHAR2,
2.681 - attr_ IN OUT VARCHAR2,
2.682 - action_ IN VARCHAR2 )
2.683 -IS
2.684 - newrec_ &TABLE%ROWTYPE;
2.685 -BEGIN
2.686 - General_SYS.Init_Method(lu_name_, '&PKG', 'New__');
2.687 - IF (action_ = 'PREPARE') THEN
2.688 - Prepare_Insert___(attr_);
2.689 - ELSIF (action_ = 'CHECK') THEN
2.690 - Unpack_Check_Insert___(attr_, newrec_);
2.691 - ELSIF (action_ = 'DO') THEN
2.692 - Unpack_Check_Insert___(attr_, newrec_);
2.693 - Insert___(objid_, objversion_, newrec_, attr_);
2.694 - END IF;
2.695 - info_ := Client_SYS.Get_All_Info;
2.696 -END New__;
2.697 -
2.698 -
2.699 -PROCEDURE Modify__ (
2.700 - info_ OUT VARCHAR2,
2.701 - objid_ IN VARCHAR2,
2.702 - objversion_ IN OUT VARCHAR2,
2.703 - attr_ IN OUT VARCHAR2,
2.704 - action_ IN VARCHAR2 )
2.705 -IS
2.706 - oldrec_ &TABLE%ROWTYPE;
2.707 - newrec_ &TABLE%ROWTYPE;
2.708 -BEGIN
2.709 - General_SYS.Init_Method(lu_name_, '&PKG', 'Modify__');
2.710 - IF (action_ = 'CHECK') THEN
2.711 - newrec_ := Get_Object_By_Id___(objid_);
2.712 - Unpack_Check_Update___(attr_, newrec_, objid_);
2.713 - ELSIF (action_ = 'DO') THEN
2.714 - oldrec_ := Lock_By_Id___(objid_, objversion_);
2.715 - newrec_ := oldrec_;
2.716 - Unpack_Check_Update___(attr_, newrec_, objid_);
2.717 - Update___(objid_, oldrec_, newrec_, attr_, objversion_);
2.718 - END IF;
2.719 - info_ := Client_SYS.Get_All_Info;
2.720 -END Modify__;
2.721 -
2.722 -
2.723 -PROCEDURE Remove__ (
2.724 - info_ OUT VARCHAR2,
2.725 - objid_ IN VARCHAR2,
2.726 - objversion_ IN VARCHAR2,
2.727 - action_ IN VARCHAR2 )
2.728 -IS
2.729 - remrec_ &TABLE%ROWTYPE;
2.730 -BEGIN
2.731 - General_SYS.Init_Method(lu_name_, '&PKG', 'Remove__');
2.732 - IF (action_ = 'CHECK') THEN
2.733 - remrec_ := Get_Object_By_Id___(objid_);
2.734 - Check_Delete___(remrec_);
2.735 - ELSIF (action_ = 'DO') THEN
2.736 - remrec_ := Lock_By_Id___(objid_, objversion_);
2.737 - Check_Delete___(remrec_);
2.738 - Delete___(objid_, remrec_);
2.739 - END IF;
2.740 - info_ := Client_SYS.Get_All_Info;
2.741 -END Remove__;
2.742 -
2.743 ------------------------------------------------------------------------------
2.744 --------------------- PUBLIC BASE METHODS ------------------------------------
2.745 ------------------------------------------------------------------------------
2.746 --- Exist
2.747 --- Checks if given pointer (e.g. primary key) to an instance of this
2.748 --- logical unit exists. If not an exception will be raised.
2.749 ------------------------------------------------------------------------------
2.750 -
2.751 -PROCEDURE Exist (
2.752 - <<<KEYARG: Put your primary key parameters here>>> )
2.753 -IS
2.754 -BEGIN
2.755 - General_SYS.Init_Method(lu_name_, '&PKG', 'Exist', TRUE);
2.756 - IF (NOT Check_Exist___(<<<KEYLS2: Put your parameters here>>>)) THEN
2.757 - Error_SYS.Record_Not_Exist(lu_name_);
2.758 - END IF;
2.759 -END Exist;
2.760 -
2.761 -PROCEDURE Exist_Db (
2.762 - <<<DBKARG: Put your primary key parameters here>>> )
2.763 -IS
2.764 -BEGIN
2.765 - General_SYS.Init_Method(lu_name_, '&PKG', 'Exist', TRUE);
2.766 - IF (NOT Check_Exist___(<<<KEYLDB: Put your parameters here>>>)) THEN
2.767 - Error_SYS.Record_Not_Exist(lu_name_);
2.768 - END IF;
2.769 -END Exist_Db;
2.770 -
2.771 ------------------------------------------------------------------------------
2.772 --------------------- PUBLIC DOMAIN METHODS ----------------------------------
2.773 ------------------------------------------------------------------------------
2.774 --- Exist
2.775 --- Checks if given pointer (e.g. domain value) to an instance of this
2.776 --- logical unit exists. If not an exception will be raised.
2.777 ---
2.778 --- Enumerate
2.779 --- Returns a list of all domain values.
2.780 ---
2.781 --- Exist_Db
2.782 --- Checks if an instance corresponding to a given database value exists.
2.783 --- If not an exception will be raised.
2.784 ------------------------------------------------------------------------------
2.785 -
2.786 -PROCEDURE Exist (
2.787 - client_value_ IN VARCHAR2 )
2.788 -IS
2.789 -BEGIN
2.790 - General_SYS.Init_Method('&LU', '&PKG', 'Exist', TRUE);
2.791 - Domain_SYS.Exist_(lu_name_, active_value_list_, client_value_);
2.792 -END Exist;
2.793 -
2.794 -
2.795 -PROCEDURE Enumerate (
2.796 - client_values_ OUT VARCHAR2)
2.797 -IS
2.798 -BEGIN
2.799 - client_values_ := Domain_SYS.Enumerate_(active_value_list_);
2.800 -END Enumerate;
2.801 -
2.802 -PROCEDURE Exist_Db (
2.803 - db_value_ IN VARCHAR2 )
2.804 -IS
2.805 -BEGIN
2.806 - General_SYS.Init_Method('&LU', '&PKG', 'Exist_Db', TRUE);
2.807 - Domain_SYS.Exist_(lu_name_, db_value_list_, db_value_);
2.808 -END Exist_Db;
2.809 -
2.810 ------------------------------------------------------------------------------
2.811 --------------------- PUBLIC DOMAIN METHODS ----------------------------------
2.812 ------------------------------------------------------------------------------
2.813 --- Encode
2.814 --- Returns the stored database representation of a domain value given the
2.815 --- client value in current language.
2.816 ---
2.817 --- Decode
2.818 --- Returns the client representation of a domain value in the
2.819 --- current client language.
2.820 ---
2.821 --- Get_Db_Value
2.822 --- Returns the database representation a domain value given its index.
2.823 ---
2.824 --- Get_Client_Value
2.825 --- Returns the client representation a domain value given its index.
2.826 ------------------------------------------------------------------------------
2.827 -
2.828 -FUNCTION Encode (
2.829 - client_value_ IN VARCHAR2 ) RETURN VARCHAR2
2.830 -IS
2.831 -BEGIN
2.832 - RETURN(Domain_SYS.Encode_(active_value_list_, db_value_list_, client_value_));
2.833 -END Encode;
2.834 -
2.835 -
2.836 -FUNCTION Decode (
2.837 - db_value_ IN VARCHAR2 ) RETURN VARCHAR2
2.838 -IS
2.839 -BEGIN
2.840 - RETURN(Domain_SYS.Decode_(active_value_list_, db_value_list_, db_value_));
2.841 -END Decode;
2.842 -
2.843 -
2.844 -FUNCTION Get_Db_Value (
2.845 - index_ IN NUMBER ) RETURN VARCHAR2
2.846 -IS
2.847 -BEGIN
2.848 - RETURN(Domain_SYS.Get_Db_Value_(db_value_list_, index_));
2.849 -END Get_Db_Value;
2.850 -
2.851 -
2.852 -FUNCTION Get_Client_Value (
2.853 - index_ IN NUMBER ) RETURN VARCHAR2
2.854 -IS
2.855 -BEGIN
2.856 - RETURN(Domain_SYS.Get_Client_Value_(active_value_list_, index_));
2.857 -END Get_Client_Value;
2.858 -
2.859 ------------------------------------------------------------------------------
2.860 --------------------- PUBLIC TRANSLATION METHODS -----------------------------
2.861 ------------------------------------------------------------------------------
2.862 -
2.863 -PROCEDURE Language_Refreshed
2.864 -IS
2.865 -BEGIN
2.866 - active_value_list_ := Language_SYS.Translate_Iid_(lu_name_, client_value_list_);
2.867 - active_state_list_ := Language_SYS.Translate_State_(lu_name_, client_state_list_);
2.868 -END Language_Refreshed;
2.869 -
2.870 ------------------------------------------------------------------------------
2.871 --------------------- LU SPECIFIC IMPLEMENTATION METHODS ---------------------
2.872 ------------------------------------------------------------------------------
2.873 -
2.874 -
2.875 ------------------------------------------------------------------------------
2.876 --------------------- LU SPECIFIC PRIVATE METHODS ----------------------------
2.877 ------------------------------------------------------------------------------
2.878 -
2.879 -
2.880 ------------------------------------------------------------------------------
2.881 --------------------- LU SPECIFIC PROTECTED METHODS --------------------------
2.882 ------------------------------------------------------------------------------
2.883 -
2.884 -
2.885 ------------------------------------------------------------------------------
2.886 --------------------- LU SPECIFIC PUBLIC METHODS -----------------------------
2.887 ------------------------------------------------------------------------------
2.888 -
2.889 -
2.890 ------------------------------------------------------------------------------
2.891 --------------------- SERVICE SPECIFIC IMPLEMENTATION METHODS ----------------
2.892 ------------------------------------------------------------------------------
2.893 -
2.894 -
2.895 ------------------------------------------------------------------------------
2.896 --------------------- SERVICE SPECIFIC PRIVATE METHODS -----------------------
2.897 ------------------------------------------------------------------------------
2.898 -
2.899 -
2.900 ------------------------------------------------------------------------------
2.901 --------------------- SERVICE SPECIFIC PROTECTED METHODS ---------------------
2.902 ------------------------------------------------------------------------------
2.903 -
2.904 -
2.905 ------------------------------------------------------------------------------
2.906 --------------------- SERVICE SPECIFIC PUBLIC METHODS ------------------------
2.907 ------------------------------------------------------------------------------
2.908 -
2.909 -
2.910 ------------------------------------------------------------------------------
2.911 --------------------- FOUNDATION1 METHODS ------------------------------------
2.912 ------------------------------------------------------------------------------
2.913 --- Init
2.914 --- Dummy procedure that can be called at database startup to ensure that
2.915 --- this package is loaded into memory for performance reasons only.
2.916 ------------------------------------------------------------------------------
2.917 -
2.918 -PROCEDURE Init
2.919 -IS
2.920 -BEGIN
2.921 - NULL;
2.922 -END Init;
2.923 -
2.924 -
2.925 -END &PKG;
2.926 -/
2.927 -SHOW ERROR
2.928 -
2.929 -undefine MODULE
2.930 -undefine LU
2.931 -undefine SERVICE
2.932 -undefine TABLE
2.933 -undefine VIEW
2.934 -undefine PKG
2.935 -undefine STATEPKG
2.936 -undefine DOMAIN
2.937 -
2.938 -undefine OBJID
2.939 -undefine OBJVERSION
2.940 -undefine OBJSTATE
2.941 -undefine OBJEVENTS
2.942 -undefine STATE
2.943 -undefine DB_VALUES
2.944 -undefine CLIENT_VALUES
2.945 -
2.946 ------------------------------------------------------------------------------
2.947 -------------------------------- STATEPACKAGE --------------------------------
2.948 ------------------------------------------------------------------------------
2.949 --- Separate Finite State Machine Package.
2.950 ------------------------------------------------------------------------------
2.951 -
2.952 -PROMPT Creating &STATEPKG implementation
2.953 -
2.954 -CREATE OR REPLACE PACKAGE BODY &STATEPKG IS
2.955 -
2.956 ------------------------------------------------------------------------------
2.957 ------------------------ STATEPACKAGE DECLARATIONS ---------------------------
2.958 ------------------------------------------------------------------------------
2.959 -
2.960 -db_state_list_ CONSTANT VARCHAR2(32000) := '&DB_STATES';
2.961 -client_state_list_ CONSTANT VARCHAR2(32000) := '&CLIENT_STATES';
2.962 -active_state_list_ VARCHAR2(32000) := Language_SYS.Translate_State_(lu_name_, client_state_list_);
2.963 -state_separator_ CONSTANT VARCHAR2(1) := Client_SYS.field_separator_;
2.964 -
2.965 ------------------------------------------------------------------------------
2.966 ---------------- LU SPECIFIC STATEPACKAGE ACTION DECLARATIONS ----------------
2.967 ------------------------------------------------------------------------------
2.968 -
2.969 ------------------------------------------------------------------------------
2.970 -------------- LU SPECIFIC STATEPACKAGE CONDITION DECLARATIONS ---------------
2.971 ------------------------------------------------------------------------------
2.972 -
2.973 ------------------------------------------------------------------------------
2.974 --------------------- IMPLEMENTATION STATEPACKAGE METHODS --------------------
2.975 ------------------------------------------------------------------------------
2.976 --- Finite_State_Set___
2.977 --- Updates the finite state indicator for an existing LU-instance.
2.978 ---
2.979 --- Finite_State_Machine___
2.980 --- Processes an event by:
2.981 --- 1. Fetching the current state
2.982 --- 2. Evaluating any conditions for given event at current state
2.983 --- 3. executing any exit code for the old state
2.984 --- 4. Performing any action associated with given event
2.985 --- 5. update the database to the new state
2.986 --- 6. execute any entry code for the new state
2.987 --- 7. Executing a state change to the new state
2.988 ------------------------------------------------------------------------------
2.989 -
2.990 -PROCEDURE Finite_State_Set___ (
2.991 - rec_ IN OUT &TABLE%ROWTYPE,
2.992 - state_ IN VARCHAR2 )
2.993 -IS
2.994 -BEGIN
2.995 - <<<FSUPDATE: Put your own SQL-statement here to set the new state>>>;
2.996 -END Finite_State_Set___;
2.997 -
2.998 -
2.999 -PROCEDURE Finite_State_Machine___ (
2.1000 - rec_ IN OUT &TABLE%ROWTYPE,
2.1001 - event_ IN VARCHAR2,
2.1002 - attr_ IN OUT VARCHAR2 )
2.1003 -IS
2.1004 - state_ VARCHAR2(30);
2.1005 -BEGIN
2.1006 - <<<FSFETCH: Put your own SQL-statement here to fetch the current state>>>;
2.1007 - <<<FSEVENT: Code for processing of events>>>;
2.1008 -END Finite_State_Machine___;
2.1009 -
2.1010 ------------------------------------------------------------------------------
2.1011 --------------------- PRIVATE STATEPACKAGE METHODS ---------------------------
2.1012 ------------------------------------------------------------------------------
2.1013 --- Finite_State_Decode__
2.1014 --- Returns the client equivalent for any database representation of
2.1015 --- a state name = objstate.
2.1016 ---
2.1017 --- Finite_State_Encode__
2.1018 --- Returns the database equivalent for any client representation of
2.1019 --- a state name = state.
2.1020 ---
2.1021 --- Enumerate_States__
2.1022 --- Returns a list of all possible finite states in client terminology.
2.1023 ---
2.1024 --- Finite_State_Events__
2.1025 --- Returns a list of allowed events for a given state
2.1026 --- NOTE! Regardless of conditions if not otherwize encoded
2.1027 ---
2.1028 --- Enumerate_Events__
2.1029 --- Returns a list of all possible events.
2.1030 ------------------------------------------------------------------------------
2.1031 -
2.1032 -FUNCTION Finite_State_Decode__ (
2.1033 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2
2.1034 -IS
2.1035 -BEGIN
2.1036 - RETURN(Domain_SYS.Decode_(active_state_list_, db_state_list_, db_state_));
2.1037 -END Finite_State_Decode__;
2.1038 -
2.1039 -
2.1040 -FUNCTION Finite_State_Encode__ (
2.1041 - client_state_ IN VARCHAR2 ) RETURN VARCHAR2
2.1042 -IS
2.1043 -BEGIN
2.1044 - RETURN(Domain_SYS.Encode_(active_state_list_, db_state_list_, client_state_));
2.1045 -END Finite_State_Encode__;
2.1046 -
2.1047 -
2.1048 -PROCEDURE Enumerate_States__ (
2.1049 - client_values_ OUT VARCHAR2)
2.1050 -IS
2.1051 -BEGIN
2.1052 - client_values_ := Domain_SYS.Enumerate_(active_state_list_);
2.1053 -END Enumerate_States__;
2.1054 -
2.1055 -
2.1056 -FUNCTION Finite_State_Events__ (
2.1057 - db_state_ IN VARCHAR2 ) RETURN VARCHAR2
2.1058 -IS
2.1059 -BEGIN
2.1060 - <<<FSEVALID: Put your code for returning valid event list here>>>;
2.1061 -END Finite_State_Events__;
2.1062 -
2.1063 -
2.1064 -PROCEDURE Enumerate_Events__ (
2.1065 - db_events_ OUT VARCHAR2 )
2.1066 -IS
2.1067 -BEGIN
2.1068 - db_events_ := '<<<FSELIST: Put your code for returning complete event list here>>>';
2.1069 -END Enumerate_Events__;
2.1070 -
2.1071 ------------------------------------------------------------------------------
2.1072 ------------------ STATEPACKAGE PUBLIC TRANSLATION METHODS -------------------
2.1073 ------------------------------------------------------------------------------
2.1074 -
2.1075 -PROCEDURE Language_Refreshed
2.1076 -IS
2.1077 -BEGIN
2.1078 - active_state_list_ := Language_SYS.Translate_State_(lu_name_, client_state_list_);
2.1079 -END Language_Refreshed;
2.1080 -
2.1081 ------------------------------------------------------------------------------
2.1082 -------------------- LU SPECIFIC STATEPACKAGE ACTIONS ------------------------
2.1083 ------------------------------------------------------------------------------
2.1084 -
2.1085 ------------------------------------------------------------------------------
2.1086 ------------------- LU SPECIFIC STATEPACKAGE CONDITIONS ----------------------
2.1087 ------------------------------------------------------------------------------
2.1088 -
2.1089 ------------------------------------------------------------------------------
2.1090 --------------------- STATEPACKAGE FOUNDATION1 METHODS -----------------------
2.1091 ------------------------------------------------------------------------------
2.1092 --- Init
2.1093 --- Dummy procedure that can be called at database startup to ensure that
2.1094 --- this package is loaded into memory for performance reasons only.
2.1095 ------------------------------------------------------------------------------
2.1096 -
2.1097 -PROCEDURE Init
2.1098 -IS
2.1099 -BEGIN
2.1100 - NULL;
2.1101 -END Init;
2.1102 -
2.1103 -
2.1104 -END &STATEPKG;
2.1105 -/
2.1106 -SHOW ERROR
3.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/template.cdb Tue Jan 17 10:44:49 2012 +0530
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,13 +0,0 @@
3.4 ------------------------------------------------------------------------------
3.5 --- Module : <<<Module name here>>>
3.6 ---
3.7 --- File : <<<Put your name here>>>.CDB
3.8 ---
3.9 --- IFS/Design Template Version 2.3
3.10 ---
3.11 --- Date Sign History
3.12 --- ------ ---- -----------------------------------------------------------
3.13 ------------------------------------------------------------------------------
3.14 -
3.15 -
3.16 -
4.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/template.cre Tue Jan 17 10:44:49 2012 +0530
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,18 +0,0 @@
4.4 ------------------------------------------------------------------------------
4.5 --- Module : <<<Module name here>>>
4.6 ---
4.7 --- File : <<<Put your name here>>>.CRE
4.8 ---
4.9 --- IFS/Design Template Version 2.3
4.10 ---
4.11 --- Date Sign History
4.12 --- ------ ---- -----------------------------------------------------------
4.13 ------------------------------------------------------------------------------
4.14 -
4.15 -
4.16 ------------------------------------------------------------------------------
4.17 --------------------- TABLES AND INDEXES -------------------------------------
4.18 ------------------------------------------------------------------------------
4.19 -
4.20 -PROMPT Creating tables and indexes
4.21 -
5.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/template.ins Tue Jan 17 10:44:49 2012 +0530
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,15 +0,0 @@
5.4 ------------------------------------------------------------------------------
5.5 --- Module : <<<Module name here>>>
5.6 ---
5.7 --- Purpose: <<<Purpose>>>
5.8 ---
5.9 --- File : <<<Put your name here>>>.INS
5.10 ---
5.11 --- IFS/Design Template Version 2.3
5.12 ---
5.13 --- Date Sign History
5.14 --- ------ ---- -----------------------------------------------------------
5.15 ------------------------------------------------------------------------------
5.16 -
5.17 -
5.18 -
6.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/template.rdf Tue Jan 17 10:44:49 2012 +0530
6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
6.3 @@ -1,99 +0,0 @@
6.4 ------------------------------------------------------------------------------
6.5 ---
6.6 --- Logical unit: <<< Enter your logical unit description here >>>
6.7 ---
6.8 --- File: TEMPLATE.RDF
6.9 --- Version: Foundation1 2.2
6.10 ---
6.11 --- Date Sign History
6.12 --- ------ ---- -----------------------------------------------------------
6.13 ---
6.14 ------------------------------------------------------------------------------
6.15 -
6.16 -define MODULE = <<<MODULE: Put your module name here>>>
6.17 -define LU = <<<LU: Put your logical unit here>>>
6.18 -define PKG = <<<PKG: Put your Package name here>>>
6.19 -
6.20 -define TABLE = <<<TABLE: Put your generic Report Table here>>>
6.21 -define RAWVIEW = <<<RAWVIEW: Put your view showing Report Table here>>>
6.22 -define VIEW = <<<VIEW: Put your Report View here>>>
6.23 -define METHOD = <<<METHOD: Put your Report Method here>>>
6.24 -
6.25 ------------------------------------------------------------------------------
6.26 --- PACKAGE SPECIFICATION:
6.27 ------------------------------------------------------------------------------
6.28 -
6.29 -PROMPT Creating &PKG specification
6.30 -
6.31 -CREATE OR REPLACE PACKAGE &PKG IS
6.32 -
6.33 -module_ CONSTANT VARCHAR2(6) := '&MODULE';
6.34 -lu_name_ CONSTANT VARCHAR2(25) := '&LU';
6.35 -
6.36 -PROCEDURE &METHOD (
6.37 - report_attr_ IN VARCHAR2,
6.38 - parameter_attr_ IN VARCHAR2 );
6.39 -
6.40 -END &PKG;
6.41 -/
6.42 -SHOW ERROR
6.43 -
6.44 ------------------------------------------------------------------------------
6.45 --- REPORTS
6.46 ------------------------------------------------------------------------------
6.47 -
6.48 -PROMPT Refreshing RPV view &RAWVIEW
6.49 -
6.50 -BEGIN
6.51 - Report_SYS.Refresh_RPV_View ('&RAWVIEW', '&TABLE');
6.52 -END;
6.53 -/
6.54 -
6.55 -PROMPT Creating report view &VIEW
6.56 -
6.57 -CREATE OR REPLACE VIEW &VIEW AS
6.58 -SELECT RESULT_KEY RESULT_KEY,
6.59 - ROW_NO ROW_NO
6.60 -FROM &RAWVIEW
6.61 -WITH read only;
6.62 -
6.63 -COMMENT ON TABLE &VIEW IS
6.64 - 'MODULE=&MODULE^LU=&LU^PROMPT=&LU^
6.65 - ^METHOD=&PKG..&METHOD^MODE=PLSQL1.2^TABLE=&TABLE^';
6.66 -
6.67 -COMMENT ON COLUMN &VIEW..RESULT_KEY IS
6.68 - 'FLAGS=M----^DATATYPE=NUMBER^';
6.69 -COMMENT ON COLUMN &VIEW..ROW_NO IS
6.70 - 'FLAGS=M----^DATATYPE=NUMBER^';
6.71 -
6.72 -
6.73 -begin
6.74 - Report_SYS.Refresh_('&VIEW');
6.75 -end;
6.76 -/
6.77 ------------------------------------------------------------------------------
6.78 --- PACKAGE IMPLEMENTATION
6.79 ------------------------------------------------------------------------------
6.80 -
6.81 -PROMPT Creating &PKG implementation
6.82 -
6.83 -CREATE OR REPLACE PACKAGE BODY &PKG IS
6.84 -
6.85 -PROCEDURE &METHOD (
6.86 - report_attr_ IN VARCHAR2,
6.87 - parameter_attr_ IN VARCHAR2 )
6.88 -IS
6.89 - result_key_ NUMBER;
6.90 - row_no_ NUMBER := 1;
6.91 -BEGIN
6.92 - result_key_ := Client_SYS.Attr_Value_To_Number(Client_SYS.Get_Item_Value('RESULT_KEY', report_attr_));
6.93 -END &METHOD;
6.94 -
6.95 -END &PKG;
6.96 -/
6.97 -SHOW ERROR
6.98 -
6.99 ------------------------------------------------------------------------------
6.100 --- END
6.101 ------------------------------------------------------------------------------
6.102 -
7.1 --- a/PLSQL/FileType/src/org/netbeans/modules/plsql/filetype/resources/template.upg Tue Jan 17 10:44:49 2012 +0530
7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
7.3 @@ -1,15 +0,0 @@
7.4 ------------------------------------------------------------------------------
7.5 --- Module : <<<Module name here>>>
7.6 ---
7.7 --- Purpose: <<<Purpose>>>
7.8 ---
7.9 --- File : <<<Put your name here>>>.UPG
7.10 ---
7.11 --- IFS/Design Template Version 2.3
7.12 ---
7.13 --- Date Sign History
7.14 --- ------ ---- -----------------------------------------------------------
7.15 ------------------------------------------------------------------------------
7.16 -
7.17 -
7.18 -