Skip to main content

Creating the hotel and hotel proxy applications

Archived

6 Tasks

20 mins

Visible to: All users
Advanced Pega Platform 8.3.1 English
This content is now archived and is no longer updated. Progress is not calculated. Pega Cloud instances are disabled, and badges are no longer awarded. Click here to continue your progress in the latest version.

Scenario

Front Stage currently hosts outdoor events. Acquisition of a company that specializes in hosting indoor event would round out FSG’s service offerings. The acquired company could utilize hotel room reservation capability within its own application without having to extend or be built on the outdoor event-hosting Booking application.

Similar to the FSGEmail application’s ability to be used by multiple applications, FSG would like its hotel room reservation capability to also be used by multiple applications.

As opposed to external hotel contacts logging into the Booking or Hotel application to indicate the number of rooms to reserve for an event, FSG wants those contacts to log into Pega Cloud-hosted “Hotel Proxy” application, that does nothing else. The “Hotel Proxy” application’s “rooms request” case would be created by the Booking or Hotel “SOR” application. The “Hotel Proxy” application’s “rooms request” case would relay the number of reserved rooms to the Booking or Hotel “SOR” application.

Front Stage also wants the hotel room request capability to leverage the FSGEmail application. Similar to the FSGEmail application, the Front Stage development team wants the hotel room reservation capability to be self-testable.

The following table provides the credentials you need to complete the exercise:

Role Operator ID Password
Admin [email protected] install
Admin Admin@Hotel rules
Admin Admin1@Hotel rules
Admin Admin@HotelProxy rules
Admin Admin1@HotelProxy rules
Admin Admin@HotelDevOnly rules
Hotel Contact [email protected] rules
Hotel Contact [email protected] rules
Note: Use Advanced/granular mode to import the RAP file and make sure to import and enable all operator ids. 

 

Build a Hotel application on the FSGEmail application. The number of rooms to request and who to contact should be propagated to the Hotel application by its parent application.

The Hotel application should communicate the number of rooms to reserve to a separate PegaCloud-hostable Hotel Proxy application. An email should be sent to the hotel contact telling that contact about the rooms request and how to log into the Hotel Proxy application to respond. The Pega API should be leveraged to achieve this goal.

The Hotel and Hotel Proxy applications should pass the same “hotel rooms request” data structure back and forth. It makes sense that this data structure be defined in a ruleset shared between the two applications. To avoid a warning, the shared ruleset should be included in a Component that both applications use.

We will also implement a third “Development Only” application that is built on the Hotel and Hotel Proxy applications. This is done to simplify packaging and deployment, plus provide an additional way to test the Hotel and Hotel Proxy applications.

In another exercise, you will create the REST interfaces between the Hotel and Hotel Proxy applications.

 

Detailed Tasks

1 Detailed steps

Tasks

Follow these steps to complete your assignment:

Building the Hotel and Hotel Proxy applications is optional. You will be instructed to leverage the already built Hotel and Hotel Proxy Applications. However, if you need the practice, you are free to construct them from scratch. If you choose to build the Hotel and Hotel Proxy applications from scratch here is a suggested order of tasks to perfrom:

  1. Create the "Hotel" application.
  2. Configure the "Rooms Request" case type..
  3. Create the "Hotel Proxy" application.
  4. Configure the "Rooms Request Proxy" case type.
  5. Define the "Rooms Request" case type life cycle.
  6. Define the "Rooms Request Proxy" case type life cycle.

Create the Hotel and HotelProxy applications

If you choose to complete this exercise from scratch, proceed as follows.

Create the Hotel application

You can skip this step if you imported the Hotel_HotelProxy_Solution.zip RAP file.

  1. From your exercise system, log on as [email protected].
  2. From the Application menu, launch the New Application wizard.
  3. In the configuration panels, select FSGEmail.
  4. When prompted to "Select case types", select the "Include all case types" checkbox.
  5. In the Name your application field, enter Hotel.
  6. Select the Advanced configuration link.
  7. In the Advanced configuration dialog, do the following:
    1. Select Implementation as the application structure.
    2. Enter FSG as the organization name.
  8. Click Save to save your updates and close the dialog.
  9. In the New Application wizard, click Create application.
  10. Generate an Admin@Hotel Operator ID then open the Operator ID and in the Security tab turn of the "Force password change on next login" checkbox and reset the password to "rules".
  11. After creating the new Hotel application, log off.
  12. Log in as Admin@Hotel.
  13. Switch to Dev Studio.
  14. Open the Hotel:Administrators access group then set the default portal to "Developer" and change the label from "FSGEmail 01.01.04 Administrator" to "Hotel 01.01.01 Administrator". 
  15. Open the Hotel application definition:
    1. Remove the FSG and FSGInt rulesets from the "Application rulesets" stack.
    2. Add a new "RoomsRequest" ruleset to the "Application rulesets" stack.
  16. Create a new Case type called, "Rooms Request" in the "RoomsRequest" ruleset.
  17. Add Existing Data Type "Address" to the Data Explorer.
  18. Add Existing Data Type "Hotel" to the Data Explorer.
  19. Configure "Email" as a child case of "RoomsRequest".

Create the HotelProxy application

You can skip this step if you imported the Hotel_HotelProxy_Solution.zip RAP file.

  1. From your exercise system, log on as [email protected].
  2. From the Application menu, launch the New Application wizard.
  3. In the configuration panels, select FSG.
  4. When prompted to, "Select data types", disable the "Include all data types".  We will be using data classes from the FSG Organizational Layer.
  5. In the Name your application field, enter HotelProxy.
  6. Select the Advanced configuration link.
  7. In the Advanced configuration dialog, do the following:
    1. Select Implementation as the application structure.
    2. Enter FSG as the organization name.
  8. Click Save to save your updates and close the dialog.
  9. In the New Application wizard, click Create application.
  10. Generate an Admin@HotelProxy Operator ID(s) then open the Operator ID and in the Security tab turn of the "Force password change on next login" checkbox and reset the password to "rules".
  11. After creating the new Hotel application, log off.
  12. Log in as Admin@HotelProxy.
  13. Switch to Dev Studio.
  14. Open the HotelProxy:Administrators access group and set the default portal to "Developer" and change the label from "Administrator" to "HotelProxy 01.01.01 Administrator". 
  15. Open the HotelProxy application definition:
    1. Remove the FSG and FSGInt rulesets from the "Application rulesets" stack.
    2. Add a new "RoomsRequestProxy" ruleset to the "Application rulesets" stack.
  16. Create a new Case type called, "Rooms Request Proxy" in the "RoomsRequestProxy" ruleset. 

2 Import the Solution RAP

The rest of the exercise steps can be completed by importing the RAP file and using the 01.01.03 unlocked version of the provided applications as described here.  To import the Solution RAP, proceed as follows.

  1. Login as [email protected].
  2. Import the Hotel_HotelProxy_Solution.zip RAP file.
  3. During import enable the Enable advanced mode to provide more granular control over the import process check-box on the File information form.
  4. During import enable the Enable new operators and overwrite existing operators on import check-box on the Operators form.
  5. During import enable the Import aged updates check-box if prompted.
  6. During import enable the Replace with older copy check-box on the Newer version of rule already on the system form if prompted.
  7. After the successful import, log-out.

Log in as Admin1@Hotel

After importing the solution RAP, review the Hotel Application.

  1. Log-in as Admin1@Hotel.
  2. When you first log-in as Admin@Hotel you will be in the Hotel • 01.01.03 application. The Hotel 01.01.03 (Hotel 01.01.03 Administrators) access group is using the Hotel • 01-01-03 application. The Hotel • 01-01-03 application represents the basic configuration that you as an LSA would prepare prior to commencement of DCO.
  3. Open the application definition for Hotel • 01.01.03. Notice that there are only three (3) rulesets: Hotel, HotelInt and RoomsRequest and they are all set to Application Validation. Notice also that Hotel • 01.01.03 is built on FSGEmail • 01.01.04.
  4. If you want to practice making the configuration changes described in this exercise:
    1. Use the Hotel 01.01.03 (Hotel 01.01.03 Administrators) access group as it is using the unlocked Hotel • 01-01-03 application with unlocked rulesets.  This is your "working" application.  Use this version of the Hotel application to practice making the configurations changes described in this exercise.
  5. Switch to the Hotel 01.01.04 (Hotel 01.01.04 Administrators) access group group via Hotel 01.01.03 > Switch Application . The Hotel 01.01.04 (Hotel 01.01.04 Administrators) access group is using the Hotel • 01.01.04 application and represents the completed steps described in this exercise. Notice that Hotel • 01.01.04 is built on FSGEmail • 01.01.04 and is using the Enabled component HotelShared_20191202T192854184 • 01.01.04.
  6. By switching back and forth between the unlocked the Hotel 01.01.03 (Hotel 01.01.03 Administrators) and the Hotel 01.01.04 (Hotel 01.01.04 Administrators) access groups you can practice select steps in this exercise while comparing and contrasting your implementation of the configurations to the provided solution.

Log in as Admin1@HotelProxy

After importing the solution RAP, review the HotelProxy Application.

  1. Log-in as Admin1@HotelProxy.
  2. When you first log-in as Admin1@HotelProxy you will be in the HotelProxy • 01.01.03 application. The Hotel Proxy 01.01.03 (Hotel Proxy 01.01.03 Administrators) access group is using the HotelProxy • 01-01-03 application. The HotelProxy • 01-01-03 application represents the basic configuration that you as an LSA would prepare prior to commencement of DCO.
  3. Open the application definition for HotelProxy • 01.01.03.
  4. Notice that there are only three (3) rulesets in the HotelProxy • 01.01.03 application's Application rulesets list: HotelProxy, HotelProxyInt and RoomsRequestProxy and they are all set to Application Validation.
  5. If you want to practice making the configuration changes described in this exercise:
    1. Use the Hotel Proxy 01.01.03 (Hotel Proxy 01.01.03 Administrators) access group as it is using the unlocked Hotel Proxy • 01-01-03 application with unlocked rulesets.  This is your "working" application.  Use this version of the Hotel Proxy application to practice making the configurations changes described in this exercise.
  6. Switch to the Hotel Proxy 01.01.04 (Hotel Proxy 01.01.04 Administrators) access group via Hotel Proxy 01.01.03 > Switch Application . The Hotel Proxy 01.01.04 (Hotel Proxy 01.01.04 Administrators) access group is using the Hotel Proxy • 01.01.04 application and represents the completed steps described in this exercise. Notice that HotelProxy • 01.01.04 is built on FSG • 01.01.04 and is using the Enabled component HotelShared_20191202T192854184 • 01.01.04.
  7. By switching back and forth between the unlocked Hotel Proxy 01.01.03 (Hotel Proxy 01.01.03 Administrators) and Hotel Proxy 01.01.04 (Hotel Proxy 01.01.04 Administrators) access groups you can practice select steps in this exercise while comparing and contrasting your implementation of the configurations to the provided solution.

3 Solution Detail

HotelShared Component

A “HotelShared_20191202T192854184” component was created. Pattern-inheritance was applied to the FSG ruleset’s FSG-Data-Hotel class to define the FSG-Data-Hotel-RoomsRequest class within the HotelShared_20191202T192854184 ruleset. The RoomsRequest class does not contain a Hotel Field Group with a pyGUID property where that pyGUID is used to perform a SOR lookup. The reason this is not done is because HotelProxy does not have access to Booking's or Hotel's SOR database, nor should it. Instead inherited scalar (single value) properties can bet set as needed, for example the hotel’s name and brand.

The RoomRequestInt ruleset is included in the HotelShared component. This makes sense because the same REST connector is used to communicate between the Hotel and Hotel Proxy applications. The Hotel application uses the REST connector’s POST method to create a Proxy case. The Hotel Proxy application uses the REST connector’s GET and PUT methods to update the Hotel Rooms Request case.

Hotel Application

The Hotel • 01.01.01 application was generated using the New Applicaton Wizard. The FSGEmail • 01.01.04 application was selected as the Hotel • 01.01.01 application's built-on application. The Hotel • 01.01.01 application has a single case type named “RoomsRequest(FSG-Hotel-Work-RoomsRequest).

RoomsRequest Case Type

The FSG-Hotel-Work-RoomRequest case type has a Field Group named Hotel of class FSG-Data-Hotel. In self-test mode it is desirable to define a new Hotel instance, save it to the database, then later be able to retrieve the same Hotel instance. An embedded page (Field Group) makes it possible to copy that page to the D_HotelSavable data page immediately prior to a “Save data page” step using the PreSaveHotel Data Transform.

The only other property used by the FSG-Hotel-Work-RoomRequest case type is a Field Group named RoomsRequest of class FSG-Data-Hotel-RoomsRequest. The last step in the "Enter Test Data" stage populates the RoomsRequest Field Group’s non-inherited properties. A parent case would propagate a fully populated FSG-Data-Hotel-RoomsRequest page to a Room Request case when used as a child case.

The Rooms Request stages that are never skipped are:

• Create Proxy
• Email Hotel
• Wait for Response
• Resolve

Create Proxy Stage

The "Create Proxy" stage is a single Utility step that invokes the CreateProxyCase activity.  This activity will be developed in a later exercise.

Email Hotel Stage

The purpose of the Email Hotel stage is to send an email to a hotel contact at a scheduled date and time. The event may be held far in the future. It is unlikely that a hotel would be able to predict its capacity far into the future. If notified too early a hotel may ignore the request. Plus the possibility exists that the event could be canceled. Not sending the email immediately allows the email to be edited prior to being sent.

The first step in the Email Hotel stage adds a Data-Party pyWorkParty(Contact) page to the RoomsRequest case by leveraging the AddWorkObjectParty activity.

Immediately following this activity, two properties are set: .pyWorkParty(Contact).pyEmail1 and .pyWorkParty(Contact).pyWorkPartyUri, both are set equal to = .RoomsRequest.Contact.pyEmail1.

Email Hotel process flow

Next, the CorrNew activity is used to Attach-and-Hold an Email Correspondence named RoomsRequest. The party role for the email is set to “Contact”. The SendNow parameter is set to “No”.

It is important to ensure that the Data-Corr-Email attachment is persisted before an Email case is created. Hence a third Utility shape labeled Commit Attachment is confgured. This Utility call the commitWithErrorHandling activity.

Finally a Create Case shape is used to create a single Email child case. The Settings tab of the Hotel case shows the three properties propagated to the Email case.

Hotel == > Email
.RoomsRequest.RequestSendDate .WhenToSendEmail
.pzInsKey .EmailWorkKey
.pyWorkParty .pyWorkParty

Wait for Response Stage

This stage consists of a single Timer step that waits until .RoomsRequest.ResponseDeadline to continue. The step can be manually continued.

Resolve Stage

This step simply resolves the case setting the status to Resolved-Completed.

4 Hotel Proxy Application

The HotelProxy • 01.01.01 application was generated using the New Applicaton Wizard. FSG • 01.01.01 was selected as the built-on application. The HotelProxy • 01.01.01 application has a single case type named “Rooms Request Proxy”.

RoomsRequest Proxy Case

The RoomsRequest Proxy case type has two stages, "Confirm Rooms" and "Resolve". The Resolve stage simply resolves the case setting the status to Resolved-Completed.

Hotel case life cycle

The actor for the "Confirm Rooms" stage is a hotel contact. The hotel contact must eventually become an authenticate-able Data-Admin-Operator-ID instance.

As shown below, a placeholder Utility shape labeled “Create HotelProxy Operator” was placed at the beginning of the ConfirmRooms_Flow process. This Utility simply calls UpdateStatus supplying “Pending-Fulfillment” as the StatusWork parameter value. The Utility could instead do two things:

1) Create a PRBasic-authenticated Operator record.
2) Provision an Identity Provider (IdP) with the hotel contact’s information to support external authentication.

Confirm rooms process flow

The Confirm Rooms assignment is routed using ToWorklist. The value supplied for the Operator parameter is .RoomsRequest.Contact.pyEmail1.

The Confirm Rooms assignment simply asks the hotel contact to enter the number of confirmed rooms. On submit, the case is resolved.

Alternatively some means could be devised where the assignment remains active until .RoomsRequest.ResponseDeadline. Doing so would allow the hotel contact to submit the number of confirmed rooms multiple times in effect allowing the number of confirmed rooms to be updated.

The Update Rooms Request SOR Case Utility calls a ConfirmRooms activity on submit.  You will create this activity in a later exercise.

5 Verify your work

Verify your configuration.

Log in as Admin1@Hotel and switch to the Hotel 01.01.04 Application and compare your solution to the completed solution.

Log in as Admin1@HotelProxy and switch to the Hotel Proxy 01.01.04 Application and compare your solution to the completed solution.

6 Solution download



Available in the following mission:

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice