System initialization

The final topic that we want to cover regarding configuration of our application is initialization of the application. When configuring an application we need to consider whether we are configuring it for a particular library or it will be used by many different libraries. In the latter case every library that will be using the application may need to perform initialization of the application specific to that library. For example, every library may use its own logo, name and address in documents that the library will be sending its members; the library may allocate a specific e-mail address to receive e-mails from members; the library may need to specify the name of the server that will be handling outgoing and incoming e-mails etc.

We want system administrator of the library to specify all these values once before the application is used by operators and members (she may also want to occasionally change these values during the operation of the system). We will show in this section how to support this initialization in the configuration.

In Aware IM there is one predefined object called SystemSettings that is responsible for storing the application initialization values (see also the Setting Initial Values of the Information System section). Aware IM creates this object automatically for any business space. The system administrator may create an instance of this object once and provide values for the attributes of this object.

The SystemSettings object by default contains attributes that allow storing values for automatic handling of outgoing and incoming e-mails. When we have been defining properties of the Email channel and incoming e-mail handling (see sending outgoing emails and handling incoming emails) we have specified that the properties should be taken from the attributes of the SystemSettings object. This allows us to let the system administrator enter these values in the Operation Mode rather than “hardwire” them in the configuration.

We can also add our own attributes to the SystemSettings object. For our library application we will add the following attributes:

Attribute NameTypeDescription
LibraryNamePlain Textthe name will be used in document templates and e-mails
LibraryAddressPlain Textthe address will be used in document templates and e-mails
LibraryTelephoneNoPlain Textthe number will be used in document templates and e-mails
MaxLoansNumberthis number identifies maximum number of loans that a member may have at any given time. From time to time the administrator may change this number
PayPalAccountName the name of the PayPal account of the library Payment by credit card

We will add these attributes to the SystemSettings object. Now we need to make changes to the document templates, e-mail notifications, rules and processes so that we use the attributes of the SystemSettings object, rather than fixed values. Note that it is not necessary to find the instance of the SystemSettings object to put it in the context, since there is always only one instance of the SystemSettings object in the system.

In particular, we will change the Total item validation rule of the Loan object to use the MaxLoans attribute:

IF Loan.Status='New' AND COUNT Loan WHERE ( Loan IN ThisLoan.Member.Loans AND Loan.Status='Current') >= SystemSettings.MaxLoans THEN 
 REPORT ERROR 'Member already has maximum allowed number of items.' 

We will also change the MakePayment process to use the name of the PayPal account (we will only change the CREATE action):

CREATE PayPalParameters WITH
   PayPalParameters.business=SystemSettings.PayPalAccountName,
   PayPalParameters.amount=Payment.Amount,
   PayPalParameters.item_name=Payment.Description 

Now we need to make sure that we let the system administrator initialize the SystemSettings object when the system is started for the first time. Note that if the values of the SystemSettings object are not provided operators and members will not be able to use the system.

We will define the process that will create the instance of the SystemSettings object and let the user specify the values for this instance and we will configure the application to use this process on startup.

The new process will have the following actions:

DISPLAY MESSAGE 'Library database has not been initialized. The system will now ask you to provide the initial data.'
 ENTER NEW SystemSettings
 CREATE PayPal
 DISPLAY MESSAGE 'Library system has been successfully initialized' 

The first action will notify the user about the initialization process, the second one will let the user enter the values of the SystemSettings object, the third action will create the instance of the PayPal object so that members can make credit card payments and the last action informs the user about the successful initialization.

The only problem is that we do not want this process to run if the application has already been initialized. Therefore, we define the wrapper process that checks the existence of the SystemSettings object:

IF NOT (EXISTS SystemSettings) THEN Initialize2 

Our first process will be called Initialize2 and the second process will be called Initialize.

Now we only need to specify that the application should use the Initialize process at start-up. To do this we open the “Administrator” visual perspective for editing. Select the “Initialize” process in the dropdown of the “Initialization process” property in the list of properties of the visual perspective. Click on the “Save” button to save changes to the visual perspective.

We have now finished the configuration of our library application. We can now test the application as described in Testing the Application and deploy it in production.

  • Last modified: 2022/09/13 18:15