Thursday, April 18, 2024

Binary in the REST response

 https://docs-previous.pega.com/data-management-and-integration/87/configuring-rest-connector-receive-binary-attachments


Configuring a REST connector to receive binary attachments

Updated on April 6, 2022

Pega Platform can receive attachments regardless of the content type or response type. Configure a REST connector to receive attachments when your application connects to a service that responds with a binary stream, for example, a PDF file or XLS file.

Before you begin:
  1. Configure your REST connector to map the response to the clipboard.
    1. On the Methods tab of your REST connector, in the GET section, click the Response tab.
    2. In the Message data section, in the Map to field, select Clipboard.
    3. In the Map to key field, enter the map to key property and then click the rule opener.
      For example: .binaryxls
      Result: The Property Record Configuration page is displayed.
  2. Configure the java object property type and the map to key.
    1. On the Property Record Configuration page, enter a name for the property, choose a class that you want to associate with the property, and select a ruleset and a ruleset version in which you want to store the property.
      For more information, see Properties.
    2. Click Create and open.
    3. On the General tab, in the Property type section, click ChangeJava Object.
    4. Click Save.
    5. Click Save on the Connect REST rule form.
  3. In the activity, define the page on which the response is mapped.
    1. On the Steps tab of the activity, in the Method field, press the Down arrow key and select Page-New.
      For more information, see Page-New method.
    2. In the Step page field, press the Down arrow key and select the name of the page to be created by this method.
      For example: BinaryAttachment
    3. On the Pages & Classes tab, enter the name of the page that you reference in step 3b and the class to which the page belongs.
  4. Call the service from the activity by using the Connect-REST method.
    1. On the Steps tab of the activity, click Add a step.
    2. In the Method field, press the Down arrow key and select Connect-REST.
    3. In the Method Parameters section, in the ServiceName field, enter the name of the service that you use to retrieve the attachment (the REST connector you configure in step 1), and then click the rule opener.
    4. In the MethodName field, select GET.
    5. In the ExecutionMode field, select Run.
    6. Click Add a step.
    7. In the Method field, press the Down arrow key and select Java.
    8. In the Method Parameters section, enter the following:
      tools.sendFile((byte[])myStepPage.getObject("Name_defined_in_response_clipboard_map_to_key "), "test.xls", false, null, true);
      where ("Name_defined_in_response_clipboard_map_to_key") is the map to key property that you enter in step 1c.
    9. Click Save.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

Contact us

Wednesday, January 3, 2024

Constellation



 Decoding the Power of Pega Constellation


Pega has introduced a new design system called constellation which is based on views instead of section and harness. Constellation is more towards configuration than customization.

The ongoing evolution of the Pega Infinity™ architecture includes the latest iteration, which is called Constellation. Constellation includes a new client-side engine that orchestrates Pega Platform application logic and data with any front-end design system. While Constellation is front-end agnostic, it is the basis for Cosmos React UI. 

There are 3 aspects in the Pega Constellation architecture :
1. Pega
2. Customer Extension
3. Builder Tools

Pega Infinity Server - This is where we are creating our applications, case types leveraging all the powerful capabilities of Pega.

There are 2 additional deployment components 
1. Constellation CDN (Static content)
2. App Static Services

When the user browser is accessing the Pega application which is built on a constellation, the browser reaches out the CDN and requests all out of the box static assets i.e. Presentation Components like how text boxes, radio buttons should be displayed.
Constellation DX components that are more complex compositions of presentational components.

Constellation Orchestration Layer - The Constellation architecture orchestrates the connection between the Pega Infinity Server and the front-end design system that is used to render the application’s user interface with the DX APIs.






Thursday, December 21, 2023

ECS

 https://academy.pega.com/topic/enterprise-class-structure/v1

https://krishnapega.blogspot.com/2016/05/enterprise-class-structure.html

https://www.pegahelp.com/2020/05/pega-enterprise-class-structure-ecs.html

https://rulesware.com/pega-evolution-of-the-enterprise-class-structure-a-perspective-of-the-last-decade/



Thursday, December 14, 2023

Pega general code review checklist

  1.  Declaratives over procedural.
  2. Reusability and Components.
  3. Extension points
  4. Avoid loops
  5. Server side validation vs Client side validation

1) Reusability - While creating/refactoring rules, always evaluate the reusability aspect. Create/move the rules to WorkPool/Work- class for better reusability.

2) Prefer Declarative over procedural processing.

3) Avoid creating section rules with 1-2 fields.

4) Avoid creating the top level scalar properties on the Casetype class (or WorkPool class). Designing better data model always fetch the future maintenance of the application. 

5) For properties that hold 'Amount' (or other decimal values) create property with type Decimal (with the desired precision as qualifier)

6) Leverage Background requestor for better user experience - Delegate the processing to background requestor such as queue processor/Agent.

7) Do not use the OOTB top-level properties for handling the processing logic. (For example, pyErrorMessage property was being used in svcPerformFlowAction OOTB activity).

8) Keep in mind the DB column size of the below properties (Especially pyLabel, PyDescription..etc)

Performance checklist

  1.  Declare index vs. exposing columns
  2. Keyed data page
  3. Virtual list copy
  4. Parallel connectors/Load data page async
  5. Simple condition as first condition in AND or OR
  6. Appropriate scope for Data pages.
  7. Reload per interaction
  8. Refresh strategy for node level datapage
  9. Report definition over obj methods

1) DB Indexes :  Analyze the query plan. Create DB Indexes on the columns that used on the filter conditions of the RD.
2) Avoid reading from Blob : Lookups read the entire blob column, so avoid reading the BLOB. Prefer to use RD's.
3) Background processing : Leverage background processing, wherever the need of processing and the data need not be shown to the user immediately. ( Agents, QueueProcessor, Async activity, load-datapage, Queue method)
4) Keyed data page : Read the data 
5) Node level : Cache the frequently accessed data in-memory.
6) Deferred loading : Configure the deferred loading on the parts of the screen (sections) that they are not interested to see imemediately.

Pega Security check list

  1. Guardrails
  2. Security alerts log
  3. Service package should be authenticated (at least basic auth + TLS)
  4. Appropriate roles + RAROS + AccessWhens + Privileges 
    • Secure Activities, flow actions, visibility through privileges
  5. Always perform server side validation
    • Data validations 
    • Attachments at certain assignment
    • Etc.
  6. Encryption
  7. Lock application and rulesets
  8. Do not deploy checkout rules
  9. Do not include operator records in Production, Block unused operators in PROD. Disable PRServlet servlet in PROD
  10. CSRF
  11. CORS
  12. CSP
  13. Appropriate logging levels
  14. Password hashing: bcrypt algorithm
  15. Authentication timeout
  16. Field level auditing
  17. Security events
  18. Client based access control : what application data is subject to data privacy regulations like GDPR and how access to that data will be handled.
  19. Secure file uploads:
  20. XML/AllowDocTypes dynamic system setting is set to false.