...
Plus précisément on pourra accéder directement aux :
- Ordres L4G (or by topic ou par thème )
- Objets graphiques
- Fonctions prédéfinies (ou par thème)
- Mots réservés
- Fonctions de la VaToolBx (ou par thème)
...
Bloc de code |
---|
/* ___ Code _____________________________________________________________________________ /* ___ ForceForcer Oracle toà answerrépondre afteraprès aun certain amount of timedélai, evenmême ifsi thel'enregistrment recordest is lockedverrouillé ______________________________ /* ___ Here we will have an answer after 5 seconds maximum. _________________________ Dans l'exemple qui suit, une réponse sera fournie après 5 secondes au maximum. ____________________________________ /* ___ TheLe paramètre 'P' parameterindique meansque alltoutes theles queriesrequêtes submittedsoumises duringdurant thela session willutiliseront havece this timeout delay délai _________________ /* ___ Le Aparamètre 'T' parameterindiquerait wouldque meanseule thatla onlyrequête thesuivante nextaurait queryce submitted during the session would have this timeout delay délai _______________________________________ callappeler_dll 'VATOOLBX.DLL' 'VaToolBxSetTimeOut' 5 'P' returnCodeBool /* ___ TryTentative tode domise anà updatejour tod'un aenregistrement database record ___ updmaj_sql employee age = age + 1 - *cond( name = 'milkwater') if *lockedbloque = _RECORD_LOCKED'1' /* the record(s) is(are) locked l'enregistrement est verrouillé else /* the recordl'(les) enregistement(s) is(are) not locked and has been updated end |
Random values
ne sont pas bloqués et ont été mis à jour
end |
...
Valeurs aléatoires
Pour générer des valeurs aléatoires, on peut utliiser les deux fonctions suivantes de la VaToolBxIn order to generate random values, we can use 2 functions of the VaToolBx package in Adelia.
- VaToolBxSeedRand
- VaToolBxRandom
1 - VaToolBxSeedRand
The VaToolBxSeedRand function is used to reset the pseudo-random number generator, which is used by the VaToolBxRandom functionLa fonction VaToolBxSeedRand est utilisée pour réinitialiser le générateur de nombre pseudo-aléatoire, lequel est utilisé par la fonction VaToolBxRandom.
2 - VaToolBxRandom
The VaToolBxRandom function is used to generate random values.
The result is a La fonction VaToolBxRandom est utilisée pour generater une valeur aléatoire.
Le resultat est un nombre de type NUM_BIN_4 number between compris entre -2147483648 and et 2147483647.
To have a value between 0 and X you can use &ABSOLUTE_VALUE and &MODULO functions (see the example abovePour avoir une valeur comprise entre 0 et X on peut utiliser les fonctions &VALEUR_ABSOLUE et &MODULO (voir l'example ci-dessous)
3 - Example
Ancre | ||||
---|---|---|---|---|
|
...
Bloc de code | ||
---|---|---|
| ||
/* ___ Declarations _____________________________________________________________________ graphic_object(colonne) colObjVar /* ___ Code _____________________________________________________________________________ colObjVar = &get_object('col_01') colObjVar:visibility = *true |
Resources
Ressources are typically used to import "external" objects in the adelia environment.
The advantage to import an object in the adelia environment is that we don't need any more the external object to use it.
It will be saved also with the backup of the environment.
1 - Creation of a resource
A resource is defined with
- name : public name of the object,
- Type : must be object,
- Program Type : where the program will be used (most of the time in windows and cloud clients)
- File name : name of the file if it is exported
- Destination : folder for the export of the resource (not used most of the time)
2 - Usage of a resource
In the BOL environment, the resources can be used for images.
When using an image (or icon) in a window, we should use a resource instead of importing the image from file system :
3 - Benefits of resources
When a resource is used (eventually in multiple programs), if we want to modify an object (image, icon, etc) , we just need to modify the resource, then analyze the resource in order to have the usage of the resource and generate the programs found.
For example, if we modify the "reduced icon" image, we just have to modify the resource used and generate the programs. We don't have to go to all the windows to change the Reduced Icon image again.
Logical Data Model
1 - How to retrieve the name of the Adelia Logical Entity from the name of the Table
In order to retrieve the name of the Adelia Logical Entity from the real name of the table , we can use the Maintenance manager accessible from the Session manager .
Then, if we select File/Table as object attribute , Logical Entity as Object type , BOLLOGP* (for example) as File name and if we press Find button , the system will show us with all the Adelia Logical files that have this part of name in the physical name :
2 - Property naming convention
The short name starts with the entity prefix (in this case RH) followed by 4 characters.
The associated fields starts with ZZ, followed by the same 4 characters.
The guide word is the same as the property name.
The associated guide word, starts with a Z followed by the name of the property without the entity prefix.
Code tips
...
Classes
Les classes sont utilisées notament pour consommer ou produire des services web
1 - JSON
Pour générer ou bien utiliser le format suivant dans un fichier JSON
Bloc de code |
---|
{
...
"BarCodeList":[
"2205",
"2206",
"2207"
]
...
}
|
Il faudra effectuer la déclaration suivante dans la définition de la classe Adelia MA_CLASSE :
Bloc de code | ||
---|---|---|
| ||
*attributs
{
...
alpha( 32) BarCodeList() *ser_nom('BarCodeList');
...
} |
Puis le code adelia suivant pour pouvoir générer des données dans ce élément :
Bloc de code |
---|
alpha( 32) BarCodeList() *ser_nom('BarCodeList'); |
...
Resources
Ressources are typically used to import "external" objects in the adelia environment.
The advantage to import an object in the adelia environment is that we don't need any more the external object to use it.
It will be saved also with the backup of the environment.
1 - Creation of a resource
A resource is defined with
- name : public name of the object,
- Type : must be object,
- Program Type : where the program will be used (most of the time in windows and cloud clients)
- File name : name of the file if it is exported
- Destination : folder for the export of the resource (not used most of the time)
2 - Usage of a resource
In the BOL environment, the resources can be used for images.
When using an image (or icon) in a window, we should use a resource instead of importing the image from file system :
3 - Benefits of resources
When a resource is used (eventually in multiple programs), if we want to modify an object (image, icon, etc) , we just need to modify the resource, then analyze the resource in order to have the usage of the resource and generate the programs found.
For example, if we modify the "reduced icon" image, we just have to modify the resource used and generate the programs. We don't have to go to all the windows to change the Reduced Icon image again.
...
Logical Data Model
1 - How to retrieve the name of the Adelia Logical Entity from the name of the Table
In order to retrieve the name of the Adelia Logical Entity from the real name of the table , we can use the Maintenance manager accessible from the Session manager .
Then, if we select File/Table as object attribute , Logical Entity as Object type , BOLLOGP* (for example) as File name and if we press Find button , the system will show us with all the Adelia Logical files that have this part of name in the physical name :
2 - Property naming convention
The short name starts with the entity prefix (in this case RH) followed by 4 characters.
The associated fields starts with ZZ, followed by the same 4 characters.
The guide word is the same as the property name.
The associated guide word, starts with a Z followed by the name of the property without the entity prefix.
...
Code tips
Bloc de code |
---|
/* ___ Declarations |
Bloc de code |
/* ___ Declarations ________________________________________________________________________ num_e(3,0) wValue /* ___ Code _____________________________________________________________________________ if wValue = 1 or wValue = 5 or wValue = 8 then /* is equivalent to if wValue = 1;5;8 then if wValue <> 1 and wValue <> 5 and wValue <> 8 then /* is equivalent to if wValue <> 1;5;8 then |
...
Bloc de code |
---|
/* ___ Declarations _____________________________________________________________________
image wImage
/* ___ Code _____________________________________________________________________________
insert_mr bol_trc_imagea('*DEBUG';'my text ';wImage;1)
|
BOL database scripts
1 - Set new PAPG values
PAPG example :
_mr bol_trc_imagea('*DEBUG';'my text ';wImage;1)
|
...
BOL database scripts
1 - Set new PAPG values
PAPG example :
Bloc de code |
---|
-- Create program configuration option MYCONFIG
delete from wms.hlxprop where XPCPRG = 'MYCONFIG';
insert into wms.hlxprop values('MYCONFIG', 'My configuration', 'MYCONFIG', '007', '011', '0', '0', 0);
delete from wms.hlpgpap where GKCPRG = 'MYCONFIG';
insert into wms.hlpgpap values('MYCONFIG',' ','1','0',' ');
|
Bloc de code |
-- Create program configuration option MYCONFIG delete from wms.hlxprophlpapdp where XPCPRGGJCPRG = 'MYCONFIG'; insert into wms.hlpapdp values('MYCONFIG',1,'Code',3,' ',' ',' '); insert into wms.hlxprophlpapdp values('MYCONFIG', 'My configuration4,'Designation',100,' 'MYCONFIG', '007', '011', '0', '0', 0); deleteinsert frominto wms.hlpgpap where GKCPRG = 'MYCONFIG'; insert into wms.hlpgpap values('MYCONFIG',' ','1','0',' '); delete from wms.hlpapdp where GJCPRG = 'MYCONFIG'; insert into wms.hlpapdp values('MYCONFIG',1,'Code',3,' ',' ',' '); insert into wms.hlpapdp values('MYCONFIG',4,'Designation',100,' ',' ',' '); insert into wms.hlpapdp values('MYCONFIG',104,'Active',1,' ',' ',' '); |
BOL REST services
1 - Call swagger REST API page
The url address of the swagger REST API page is :
2 - Generate the JWT token
To generate the JWT token, you'll have to access to the following url, but replace XXX with your reflex login and YYY with your reflex password
3 - Apply the JWT token
To apply the JWT token to the rest call, press the Authorize button on top of the REST API page.
Then enter "JWT" , a space character AND the token generated for your user/pass informations.
hlpapdp values('MYCONFIG',104,'Active',1,' ',' ',' '); |
...
BOL REST services
1 - Call swagger REST API page
The url address of the swagger REST API page is :
2 - Generate the JWT token
To generate the JWT token, you'll have to access to the following url, but replace XXX with your reflex login and YYY with your reflex password
3 - Apply the JWT token
To apply the JWT token to the rest call, press the Authorize button on top of the REST API page.
Then enter "JWT" , a space character AND the token generated for your user/pass informations.
Then press Authorize button.
...
REFLEX REST services web
1 - Swagger et visualisation des web services spécifiques
Afin de pouvoir visualiser ses services web spécifiques dans l'interface de swagger, il faudra modifier le fichier de configuration wsRestConf.properties présent dans le répertoires de configuration reflex web (C:\Hardis\Reflex\conf en version windows)
On ajoutera la valeur ",com.hardis.reflex" à la ligne correspondant à la clef "SWAGGER2FEATURE.resourcePackage"
Bloc de code | ||
---|---|---|
| ||
...
SWAGGER2FEATURE.resourcePackage=com.hardis.reflex.publicapi,com.hardis.adelia.webservice,com.hardis.reflex
... |
2 - Swagger et chapitres
Afin de regrouper les web services par types de services sans avoir à mettre tous les services (procédures) dans le même programme, il suffira d'ajouter dans le code de configuration "sw_configurer *service _ws_rest_swag_description ..." pour que le service soit ajouté à un groupe de web services.
Par exemple afin de regrouper des services web de test sous le chapitre "XXX - Web services de test (STUB)", il faudra écrire le code suivant dans le paragraphe DECL_PGM du programme contenant le(s) service(s) :
Bloc de code | ||
---|---|---|
| ||
DECL_PGM
...
sw_configurer *service _ws_rest_swag_description 'XXX - Web services de test (STUB)'
... |
De cette façon, une fois le(s) service(s) généré(s), on verra le chapitre suivant dans swagger :
Then press Authorize button.