Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

...

Plus précisément on pourra accéder directement aux :

...

2 - Enregistrements verrouillés

One or several lines in a table can be locked. This is caused by a process which modified records in a table without committing the changes. The consequence is that no other process can modify the lines before the first commit or rollback was executed. Even a locked record can not be modified, it can be read by another database user.

With the reserved world *LOCKED, it is possible in Adelia to check if a record is locked. It needs to be used after a database modification statement (UPD_SQL or DELETE).

Une ou plusieurs lignes d'une table peuvent être verrouillées. Ceci peut être dû à un processus qui a modifié des éléments sans pour autant avoir validé (commit) les modifications. En conséquence, aucun autre processus ne pourra modifier les lignes avant qu'une instruction VALIDER_MAJ (ou ANNULER_MAJ) n'ait été exécutée.
Si un enregistrement verrouillé, alors il ne pourra pas être modifié. Par contre il pourra être lu par un autre utilisateur.

Le mot reservé *BLOQUE permet de vérifier si un enregistrement est verrouillé. On le consulte après un accès modifiant la base de données (MAJ_SQL ou SUPPRIMER_SQL etc..).

  • *BLOQUE = '1' : l'enregistrement est verrouillé 
  • *BLOQUE = '0' : l'enregistrement n'est pas verrouillé (on peut également utiliser la constante _RECORD_LOCKED à la place de la valeur
  • *LOCKED = '1' : record is locked 
  • *LOCKED = '0' : record is not locked (we can use the constant _RECORD_LOCKED instead of the value '1')


Remarque
titleAttention

By default Oracle waits an infinite amount of time after an update (or delete) operation if the record is locked.
It would answer only after the record has been released.
To change this behavior, we must use the 'VaToolBxSetTimeOut' method of the VaToolBx library (see example belowPar défaut Oracle attend un temps "infini" après une opération de mise à jour/suppression si un enregistrement est verrouillé.
La main sera rendue au programme seulement lorsque l'enregistrement aura été libéré.
Pour changer ce comportement, on utilisera la méthode 'VaToolBxSetTimeOut' de la VaToolBx library (cf exemple ci-dessous)


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 secondsDans l'exemple qui suit, une réponse sera fournie après 5 secondes au maximum. ____________________________________________
/* ___ Le paramètre 'P' indique que toutes les requêtes soumises durant la session utiliseront ce délai _________________
/* ___ Le Theparamètre 'PT' parameterindiquerait meansque allseule thela queriesrequête submittedsuivante duringaurait thece session will have this timeout delay délai _________________________________
/* ___ A 'T' parameter would mean that only the next query submitted during the session would have this timeout delay ___

callappeler_dll 'VATOOLBX.DLL' 'VaToolBxSetTimeOut' 5 'P' returnCodeBool

/* ___ TryTentative tode domise anà updatejour tod'un a database record enregistrement ____

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
randomExample
randomExample

...

Bloc de code
titleExamples of 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

Image Removed

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 :

Image Removed

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.

Image Removed

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 .

Image Removed

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 :

Image Removed

2 - Property naming convention

Image Removed

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
titleclasse MA_CLASSE
*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

Image Added

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 :

Image Added

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.

Image Added

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 .

Image Added

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 :

Image Added

2 - Property naming convention


Image Added

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
/* ___ 
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

...

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

Image Removed

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.

Image Removed

Then enter "JWT" , a space character AND the token generated for your user/pass informations.

Image Removed

Image Added

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.

Image Added

Then enter "JWT" , a space character AND the token generated for your user/pass informations.

Image Added

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
titlewsRestConf.properties
...
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
titlewsRestConf.properties
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 :

Image AddedThen press Authorize button.