unRecipe 9.1.0
|
LIBRARY: unRecipeDbFunctions.ctl | |
Creation Date: September 2014 version 1.4.0 Modification History: 09/09/2014: Ivan
External Functions: . Internal Functions: |
|
global bool | g_bCancelSaveRecipeToDb |
global bool | g_bSaveRecipeToDbFinished |
global dyn_string | g_dsLockedDevicesBySaveToDb |
global bool | g_bCloseProgressDialog |
global dyn_int | g_iProgressOperationIds |
global int | g_iCurrentOperation |
global dyn_string | g_dsProgressOperationNames |
global mapping | g_mProgressOperationStatus |
global float | g_fProgressValue |
const int | PROGRESS_OPERATION_ON_PROGRESS = 0 |
const int | PROGRESS_OPERATION_COMPLETED = 1 |
const int | PROGRESS_OPERATION_FAILED = -1 |
const int | PROGRESS_OPERATION_SKIPPED = -2 |
const int | DB_SAVE_RCP_CLASS_SAVED = 1 |
const int | DB_SAVE_RCP_INSTANCE_SAVED = 2 |
const int | DB_SAVE_RCP_CLASS_AND_INSTANCES_COMPLETED = 3 |
const int | DB_SAVE_ERROR_CANNOT_LOCK_CLASS = -1 |
const int | DB_SAVE_ERROR_CANNOT_LOCK_INSTANCE = -2 |
const int | DB_SAVE_ERROR_BAD_RCP_CLASS_STATE = -3 |
const int | DB_SAVE_ERROR_BAD_RCP_INSTANCE_STATE = -4 |
const int | DB_SAVE_ERROR_CANNOT_LOAD_INSTANCE = -5 |
const int | DB_SAVE_ERROR_CANNOT_SAVE_CLASS = -6 |
const int | DB_SAVE_ERROR_CANNOT_SAVE_INSTANCE = -7 |
const int | DB_SAVE_ERROR_CANNOT_RESET_INSTANCE = -8 |
const int | DB_SAVE_SKIP_RCP_INSTANCE = -9 |
const string | RCP_CLASS_INTERNAL_SUFFIX = ".internalClass" |
const string | RCP_INST_INTERNAL_SUFFIX = ".internalInstance" |
const int | RCP_CLASS_INTERNAL_DESC = 1 |
const int | RCP_CLASS_INTERNAL_EDITABLE = 2 |
const int | RCP_CLASS_INTERNAL_ELEMENTS = 3 |
const int | RCP_CLASS_INTERNAL_TYPE = 4 |
const int | RCP_CLASS_INTERNAL_DEVICE_ORDER = 5 |
const int | RCP_CLASS_INTERNAL_ACDOMAIN = 6 |
const int | RCP_CLASS_INTERNAL_ADMIN = 7 |
const int | RCP_CLASS_INTERNAL_EXPERT = 8 |
const int | RCP_CLASS_INTERNAL_OPERATOR = 9 |
const int | RCP_CLASS_INTERNAL_DEVICE_LINK = 10 |
const int | RCP_INST_INTERNAL_INITIAL = 1 |
const int | RCP_INST_INTERNAL_DESC = 2 |
const int | RCP_INST_INTERNAL_ACDOMAIN = 3 |
const int | RCP_INST_INTERNAL_ADMIN = 4 |
const int | RCP_INST_INTERNAL_EXPERT = 5 |
const int | RCP_INST_INTERNAL_OPERATOR = 6 |
void | unRecipeFunctions_displayDbValues (string sRecipeDpName, time validAt, dyn_string &exceptionInfo) |
void | unRecipeDbFunctions_getRecipeInstanceDbValues (string sRcpDp, dyn_string &dsDpNames, dyn_anytype &daFormattedValues, time validAt, dyn_string &exceptionInfo) |
void | unRecipeFunctions_saveRecipeToDb (string sRecipeDp, dyn_string &exceptionInfo) |
bool | _unRecipeFunctions_getRecipeClassData (string sRecipeDp, string &sRcpClassName, string &sRcpClassDp, bool &bDpIsRcpClass) |
bool | _unRecipeFunctions_getSaveOperationIds (dyn_string dsRcpClassDps, dyn_int &diOperationIds, dyn_string &dsOperationNames, dyn_string &exceptionInfo) |
void | _unRecipeFunctions_saveRecipeClassesToDb (dyn_string dsRcpClassDps, dyn_string dsRcpClassNames, string sComment) |
void | unRecipeFunctions_cancelSaveRecipeToDb () synchronized(g_bCancelSaveRecipeToDb) |
void | _unRecipeFunctions_removeLockedDeviceBySaveToDb (string sDeviceDp) |
void | unRecipeFunctions_unlockDevicesLockedBySaveToDb () |
void | _unRecipeFunctions_saveRecipeClassAndInstancesToDb (string sRcpClassDp, string sRcpClassName, string sComment, dyn_string dsRcpDbList) |
void | _unRecipeFunctions_skipSaveRecipeInstancesToDb (string sClassName, dyn_string dsInstanceNames, dyn_string dsInstanceDps) |
bool | _unRecipeFunctions_saveRecipeClassToDb (string sRcpClassDp, string sRcpClassName, dyn_string dsRcpDbList) |
bool | _unRecipeFunctions_saveRecipeInstanceToDb (string sRcpDp, string sRcpClassName, string sRcpInstName, string sComment, dyn_string dsRcpDbList, dyn_string &exceptionInfo, bool isPeriodicSave=false) |
bool | _unRecipeFunctions_saveRecipeClassInternalToDb (string sClassDp, string sClassName, dyn_string dsRcpDbList, dyn_string &exceptionInfo) |
bool | _unRecipeFunctions_saveRecipeInstanceInternalToDb (string sRcpDp, string sRcpName, dyn_string dsRcpDbList, dyn_string &exceptionInfo) |
bool | _unRecipeFunctions_saveInternalRecipeToDb (string sInternalRcpName, string sDomainNature, dyn_string dsDeviceElements, dyn_string dsRcpDbList, dyn_string &exceptionInfo) |
int | _unRecipeFunctions_saveRecipeToDb (dyn_dyn_mixed recipeObject, string hierarchyType, string recipeName, dyn_string &exceptionInfo, string versionDescription="", bool autoSaveDevices=FALSE, bool updateDevices=FALSE) |
void | _unRecipeFunctions_createRecipeClassFromDbInternal (string sSystemName, string sClassName, dyn_string &exceptionInfo) |
void | _unRecipeDbFunctions_getRecipeClassObjectFromDbInternal (string sRcpClassDp, dyn_mixed &recipeClassObject, dyn_string &exceptionInfo) |
void | _unRecipeFunctions_createRecipeInstanceFromDbInternal (string sSystemName, string sClassName, string sInstName, dyn_string &exceptionInfo) |
void | unRecipeFunctions_loadRecipeClassInstancesFromDb (string sRcpClassDp, time tValidAt=0) |
void | unRecipeFunctions_loadRecipeMetadataFromDb (string sRcpDp, string &lastSavedBy, string &lastSavedTime) |
void | unRecipeFunctions_loadRecipesFromDb (dyn_string dsSelectedRecipes, time tValidAt=0) |
bool | unRecipeFunctions_loadSingleRecipeFromDb (string sRcpName, time tValidAt=0) |
bool | _unRecipeFunctions_getExistingClassOrCreateNewClassFromDb (string sSystemName, string sRcpClassName, dyn_dyn_mixed &recipeObject) |
bool | _unRecipeFunctions_getExistingInstanceOrCreateNewInstanceFromDb (string sSystemName, string sRcpClassName, string sRcpInstanceName, dyn_dyn_mixed &recipeObject) |
void | _unRecipeFunctions_finalizeSaveRecipeToDb (int iCode, string sDeviceName, string sDeviceDp, string sState, dyn_string &exceptionInfo, bool isPeriodicSave=false) |
void | _unRecipeFunctions_printDbSaveMessage (int iCode, string sDeviceName, string sState, dyn_string &exceptionInfo, bool isPeriodicSave=false) |
void | unRecipeFunctions_saveRecipesToDb (dyn_string dsRcpDps, string sComment) |
void | _unRecipeFunctions_getRecipeClassList (dyn_string dsRcpDps, dyn_string &dsRcpClassDps, dyn_string &dsRcpClassNames) |
bool | _unRecipeFunctions_saveRecipeObjectToDb (dyn_dyn_mixed recipeObject, string sComment, dyn_string &exceptionInfo, bool isPeriodicSave=false) |
bool | unRecipeFunctions_getRecipeInstancesFromDatabase (dyn_string &dsRcpInstanceNames, dyn_string &exceptionInfo) |
void | unRecipeFunctions_deleteRecipeInstancesFromDb (dyn_string dsRecipeNames) |
void | _unRecipeFunctions_dropRecipeInDb (string sRecipeName, bool bShowMessage=TRUE) |
void | _unRecipeFunctions_openProgressDialog (dyn_int diOperationIds, dyn_string dsOperationNames) |
void | _unRecipeFunctions_startProgressDialog () |
void | _unRecipeFunctions_closeProgressDialog () |
string | _unRecipeFunctions_getCurrentOperationId () |
void | _unRecipeFunctions_setOperationStatus (int status, string sOperationName) |
UNICOS Copyright (C) CERN 2014 All rights reserved
void unRecipeFunctions_displayDbValues | ( | string | sRecipeDpName, |
time | validAt, | ||
dyn_string & | exceptionInfo | ||
) |
Load the recipe values from the database in the recipe instance panel.
sRecipeDpName | - [IN] String containing the recipe instance DP name. |
validAt | - [IN] The recipe values are requested for the specified time in the database. |
exceptionInfo | - [OUT] Standard exception handling variable. |
void unRecipeDbFunctions_getRecipeInstanceDbValues | ( | string | sRcpDp, |
dyn_string & | dsDpNames, | ||
dyn_anytype & | daFormattedValues, | ||
time | validAt, | ||
dyn_string & | exceptionInfo | ||
) |
Get the database values of a recipe instance.
sRcpDp | - [IN] DP Names of the recipe instance. |
dsDpNames | - [OUT] DP Names of the recipe elements. |
daFormattedValues | - [OUT] Online formatted values corresponding to the recipe class DPEs. |
validAt | - [IN] The recipe values are requested for the specified time in the database. |
exceptionInfo | - [OUT] Standard exception handling variable. |
void unRecipeFunctions_saveRecipeToDb | ( | string | sRecipeDp, |
dyn_string & | exceptionInfo | ||
) |
Save a recipe class and all its instances to the database. The function is called from the recipe class/instance panel when the 'Save to DB ...' button is pressed.
sRecipeDp | - [IN] The DP of the recipe instance. |
exceptionInfo | - [OUT] Standard exception handling variable. |
bool _unRecipeFunctions_getRecipeClassData | ( | string | sRecipeDp, |
string & | sRcpClassName, | ||
string & | sRcpClassDp, | ||
bool & | bDpIsRcpClass | ||
) |
Get the recipe class data from a datapoint (recipe class/recipe instance).
sRecipeDp | - [IN] Datapoint element of a recipe class or recipe instance. |
sRcpClassName | - [OUT] Recipe class name associated to the sRecipeDp parameter. |
sRcpClassDp | - [OUT] Recipe class datapoint associated to the sRecipeDp parameter. |
bDpIsRcpClass | - [OUT] TRUE if the sRecipeDp belongs to a recipe class, otherwise FALSE. |
bool _unRecipeFunctions_getSaveOperationIds | ( | dyn_string | dsRcpClassDps, |
dyn_int & | diOperationIds, | ||
dyn_string & | dsOperationNames, | ||
dyn_string & | exceptionInfo | ||
) |
Get the operation IDs and names for the progress dialog when a recipe class (and all its instances) will be saved.
dsRcpClassDps | - [IN] DPEs of the recipe classes to save in the database. |
diOperationIds | - [OUT] List of operation IDs for the progress dialog. |
dsOperationNames | - [OUT] List of operation names for the progress dialog. |
exceptionInfo | - [OUT] Standard exception handling variable. |
void _unRecipeFunctions_saveRecipeClassesToDb | ( | dyn_string | dsRcpClassDps, |
dyn_string | dsRcpClassNames, | ||
string | sComment | ||
) |
Save a list of recipe classes to the ORACLE database.
dsRcpClassDps | - [IN] Recipe class DP names. |
dsRcpClassNames | - [IN] Recipe class names. |
sComment | - [IN] Comment for the DB history. |
void unRecipeFunctions_cancelSaveRecipeToDb | ( | ) |
Trigger the cancel of a save to db operation.
void _unRecipeFunctions_removeLockedDeviceBySaveToDb | ( | string | sDeviceDp | ) |
Remove a device from the list of locked devices by a save to db operation.
sDeviceDp | - [IN] The DP name of the device. |
void unRecipeFunctions_unlockDevicesLockedBySaveToDb | ( | ) |
Unlock the devices currently locked by a save to db operation.
void _unRecipeFunctions_saveRecipeClassAndInstancesToDb | ( | string | sRcpClassDp, |
string | sRcpClassName, | ||
string | sComment, | ||
dyn_string | dsRcpDbList | ||
) |
Save a recipe class and all its instances to the ORACLE database.
sRcpClassDp | - [IN] Recipe class DP name. |
sRcpClassName | - [IN] Recipe class name. |
sComment | - [IN] Comment for the DB history. |
dsRcpDbList | - [IN] List of recipes saved in the ORACLE database. |
void _unRecipeFunctions_skipSaveRecipeInstancesToDb | ( | string | sClassName, |
dyn_string | dsInstanceNames, | ||
dyn_string | dsInstanceDps | ||
) |
Skip saving the recipe instances after a failure saving the recipe class.
sClassName | - [IN] Recipe class name. |
dsInstanceNames | - [IN] Recipe instance names. |
dsInstanceDps | - [IN] Recipe instance datapoint names. |
bool _unRecipeFunctions_saveRecipeClassToDb | ( | string | sRcpClassDp, |
string | sRcpClassName, | ||
dyn_string | dsRcpDbList | ||
) |
Internal function to save a recipe class to the ORACLE database.
sRcpClassDp | - [IN] Datapoint name of the recipe class. |
sRcpClassName | - [IN] Recipe class name. |
dsRcpDbList | - [IN] List of recipes saved in the database. |
bool _unRecipeFunctions_saveRecipeInstanceToDb | ( | string | sRcpDp, |
string | sRcpClassName, | ||
string | sRcpInstName, | ||
string | sComment, | ||
dyn_string | dsRcpDbList, | ||
dyn_string & | exceptionInfo, | ||
bool | isPeriodicSave = false |
||
) |
Internal function to save a recipe instance to the ORACLE database.
sRcpDp | - [IN] Datapoint name of the recipe instance. |
sRcpClassName | - [IN] Recipe class name. |
sRcpInstName | - [IN] Recipe instance name. |
sComment | - [IN] Comment for the DB history. |
dsRcpDbList | - [IN] List of recipes already saved in the ORACLE database. |
exceptionInfo | - [OUT] Standard exception handling variable. |
isPeriodicSave | - [IN] Determines whether the function is running in the background or not. |
bool _unRecipeFunctions_saveRecipeClassInternalToDb | ( | string | sClassDp, |
string | sClassName, | ||
dyn_string | dsRcpDbList, | ||
dyn_string & | exceptionInfo | ||
) |
Create an internal recipe from the recipe class. This recipe contains required DPEs from the recipe class definition.
sClassDp | - [IN] Datapoint name of the recipe class. |
sClassName | - [IN] Recipe class name. |
dsRcpDbList | - [IN] List of recipes available in the Oracle database. |
exceptionInfo | - [OUT] Standard exception handling variable. |
bool _unRecipeFunctions_saveRecipeInstanceInternalToDb | ( | string | sRcpDp, |
string | sRcpName, | ||
dyn_string | dsRcpDbList, | ||
dyn_string & | exceptionInfo | ||
) |
Create an internal recipe from the recipe instance. This recipe contains required DPEs from the recipe instance definition.
sRcpDp | - [IN] Datapoint name of the recipe instance. |
sRcpName | - [IN] Recipe instance name. |
dsRcpDbList | - [IN] List of recipes available in the Oracle database. |
exceptionInfo | - [OUT] Standard exception handling variable. |
bool _unRecipeFunctions_saveInternalRecipeToDb | ( | string | sInternalRcpName, |
string | sDomainNature, | ||
dyn_string | dsDeviceElements, | ||
dyn_string | dsRcpDbList, | ||
dyn_string & | exceptionInfo | ||
) |
Creates and saves an internal recipe to the Oracle database.
sInternalRcpName | - [IN] Name of the internal recipe. |
sDomainNature | - [IN] Domain and nature of the recipe. |
dsDeviceElements | - [IN] List of devices to include in the recipe. |
dsRcpDbList | - [IN] List of recipes available in the Oracle database. |
exceptionInfo | - [OUT] Standard exception handling variable. |
int _unRecipeFunctions_saveRecipeToDb | ( | dyn_dyn_mixed | recipeObject, |
string | hierarchyType, | ||
string | recipeName, | ||
dyn_string & | exceptionInfo, | ||
string | versionDescription = "" , |
||
bool | autoSaveDevices = FALSE , |
||
bool | updateDevices = FALSE |
||
) |
TODO: This function is used to replace fwConfigurationDB_saveRecipeToDB and be able to update the devices in the call to _fwConfigurationDB_saveItemsToDB
void _unRecipeFunctions_createRecipeClassFromDbInternal | ( | string | sSystemName, |
string | sClassName, | ||
dyn_string & | exceptionInfo | ||
) |
Create a recipe class in the system from an internal recipe class saved in the Oracle database.
sSystemName | - [IN] System name. |
sClassName | - [IN] Name of the recipe class to create. |
exceptionInfo | - [OUT] Standard exception handling variable. |
void _unRecipeFunctions_createRecipeInstanceFromDbInternal | ( | string | sSystemName, |
string | sClassName, | ||
string | sInstName, | ||
dyn_string & | exceptionInfo | ||
) |
Create a recipe instance in the system from an internal recipe instance saved in the Oracle database.
sSystemName | - [IN] System name. |
sClassName | - [IN] Name of the recipe class. |
sInstName | - [IN] Name of the recipe instance. |
exceptionInfo | - [OUT] Standard exception handling variable. |
void unRecipeFunctions_loadRecipeClassInstancesFromDb | ( | string | sRcpClassDp, |
time | tValidAt = 0 |
||
) |
Load the instances of a recipe class from the ORACLE database.
sRcpClassDp | - [IN] Datapoint name of the recipe class. |
tValidAt | - [IN] Time when the recipe was valid. |
void unRecipeFunctions_loadRecipeMetadataFromDb | ( | string | sRcpDp, |
string & | lastSavedBy, | ||
string & | lastSavedTime | ||
) |
Loads the recipe metadata (last saved by, last saved time) from the DB
sRcpDp | - [IN] Datapoint name of the recipe. |
lastSavedBy | - [OUT] User who last saved the recipe in the database. |
lastSavedTime | - [OUT] Time when the recipe was last saved in the database. |
void unRecipeFunctions_loadRecipesFromDb | ( | dyn_string | dsSelectedRecipes, |
time | tValidAt = 0 |
||
) |
Load a list of recipe instances from the Oracle database. If the recipe class or recipe instance don't exist in the system they will be created.
dsSelectedRecipes | - [IN] List of recipes to load from the Oracle database. |
tValidAt | - [IN] Time when the recipes were valid. |
bool unRecipeFunctions_loadSingleRecipeFromDb | ( | string | sRcpName, |
time | tValidAt = 0 |
||
) |
Load a recipe instance from the Oracle database. If the recipe class or recipe instance don't exist in the system they will be created.
sRcpName | - [IN] Name of the recipe to load from the Oracle database. |
tValidAt | - [IN] Time when the recipe is valid. |
bool _unRecipeFunctions_getExistingClassOrCreateNewClassFromDb | ( | string | sSystemName, |
string | sRcpClassName, | ||
dyn_dyn_mixed & | recipeObject | ||
) |
Internal function to load the recipe class data or to create a new recipe class if it doesn't exist.
sSystemName | - [IN] System name. |
sRcpClassName | - [IN] Recipe class name. |
recipeObject | - [OUT] Recipe class data. |
bool _unRecipeFunctions_getExistingInstanceOrCreateNewInstanceFromDb | ( | string | sSystemName, |
string | sRcpClassName, | ||
string | sRcpInstanceName, | ||
dyn_dyn_mixed & | recipeObject | ||
) |
Internal function to load the recipe instance data or to create a new recipe instance if it doesn't exist.
sSystemName | - [IN] System name. |
sRcpClassName | - [IN] Recipe class name. |
sRcpInstanceName | - [IN] Recipe instance name. |
recipeObject | - [OUT] Recipe instance data. |
void _unRecipeFunctions_finalizeSaveRecipeToDb | ( | int | iCode, |
string | sDeviceName, | ||
string | sDeviceDp, | ||
string | sState, | ||
dyn_string & | exceptionInfo, | ||
bool | isPeriodicSave = false |
||
) |
Finalize the operation of saving a recipe device to the Oracle database.
iCode | - [IN] Return code of the save operation. |
sDeviceName | - [IN] Name of the recipe device saved to the database. |
sDeviceDp | - [IN] Datapoint name of the recipe device saved to the database. |
sState | - [IN] State of the recipe device. |
exceptionInfo | - [OUT] Standard exception handling variable. |
isPeriodicSave | - [IN] Determines whether the function is running in the background or not. |
void _unRecipeFunctions_printDbSaveMessage | ( | int | iCode, |
string | sDeviceName, | ||
string | sState, | ||
dyn_string & | exceptionInfo, | ||
bool | isPeriodicSave = false |
||
) |
Print a message in the recipe log window after trying to save a recipe in the Oracle database.
iCode | - [IN] Return code of the save operation. |
sDeviceName | - [IN] Name of the recipe device saved to the database. |
sState | - [IN] State of the recipe device. |
exceptionInfo | - [OUT] Standard exception handling variable. |
isPeriodicSave | - [IN] Determines whether the function is running in the background or not. |
void unRecipeFunctions_saveRecipesToDb | ( | dyn_string | dsRcpDps, |
string | sComment | ||
) |
Save a list of recipes to the database.
dsRcpDps | - [IN] List of recipe DPs to save to the database. |
sComment | - [IN] Comment for the DB history. |
|
private |
Get the list of recipe classes from a list of recipes.
dsRcpDps | - [IN] List of recipe DPs. |
dsRcpClassDps | - [OUT] List of recipe class DPs. |
dsRcpClassNames | - [OUT] List of recipe class Names. |
bool _unRecipeFunctions_saveRecipeObjectToDb | ( | dyn_dyn_mixed | recipeObject, |
string | sComment, | ||
dyn_string & | exceptionInfo, | ||
bool | isPeriodicSave = false |
||
) |
Internal function to save a recipe object to the database.
recipeObject | - [IN] Recipe object to be saved in the database. |
sComment | - [IN] Comment for the DB history. |
exceptionInfo | - [OUT] Standard exception handling variable. |
isPeriodicSave | - [IN] Determines whether the function is running in the background or not. |
bool unRecipeFunctions_getRecipeInstancesFromDatabase | ( | dyn_string & | dsRcpInstanceNames, |
dyn_string & | exceptionInfo | ||
) |
Get the list of recipe instances from the Oracle database.
dsRcpInstanceNames | - [OUT] Names of the recipe instances saved in the database. |
exceptionInfo | - [OUT] Standard exception handling variable. |
void unRecipeFunctions_deleteRecipeInstancesFromDb | ( | dyn_string | dsRecipeNames | ) |
Delete a list of recipe instances from the ORACLE database.
dsRecipeNames | - [IN] List of the recipe instances to delete from the ORACLE database. |
void _unRecipeFunctions_dropRecipeInDb | ( | string | sRecipeName, |
bool | bShowMessage = TRUE |
||
) |
Internal function to delete a recipe from the ORACLE database.
sRecipeName | - [IN] Name of the recipe to delete. |
bShowMessage | - [IN] TRUE if a confirmation message must be added to the log window, otherwise FALSE. |