Saravanan's Corner: Blackberry Dev

Monday, 17 September 2018

Data class and Work class in Pega


Classes in Pega

  • Base Class, Work Class,  Data class, Int Class..etc

Work class



If you want the class to perform some work or some case, then you will need to directly inherit the "work-" class as a parent. This makes the class you are creating a "work Class". It's job to be instantiated as a work object or a Case Object to contain data related to work it is doing.
  • Work class - Something inheriting from Work - class of Pega
  • Work class should contain all business rule (Workflows, Section, Flow action, Decision, Validation)
  • Purpose of the work class is creating business rules and Instantiating a case.
  • Work classes are very specific for your application.
  • Work classes are direct inheritance or pattern inheritance


Data class

 

If you want the class to represent a Data Model, create a class that directly inherit the "Data-" class as a parent. so this becomes a "Data Class".  It's job to be a data model for whatever data you want to represent in PRPC. Usually, a Data Class is not Instantiated, and it is used more as a template in the Work Class for containing data that is pertinent to work to be resolved.
  • Data classes complete separate data component
  • Data classes nothing but dealing with data model which is nothing but data process
  • Static tables are created in a central repository to display their data's in front end.

Work class vs Data class

  • All work classes will reuse the data classes across components/application.
  • Basically, the difference is what they do. In summary, a Data Class is a template for Data Model, a Work Class represents a work type or case type for instantiating and resolving work.
  • Data classes normally contain properties, sections, decision rules, etc for reuse, Unless you have a very special requirement, flows should be defined at the work level for standard.
  • Data class - drop down data's, to show up some data to user to choose for transaction
  • Work class - Transactions - all case details get stored into work classes. for example, capturing order details, payment details in workflows etc...
  • Work class-create cases, and to store that case data we need table.

Can we create a Flow Rule under the Data Class?


  • If you want to use the same flow rule in different work classes, then we can create the flow in Data classes and use it in application work classes,
  • We can technically create a flow rule in data class, but typically flows are created in Work classes.

Pega Data Mapping

  • There is a rule called as DATA BASE - here you create a mapping between Pega and database.
  • - Goto under Records explorer -> SysAdmin-> Database -> Create mapping ->. instances of databases
  • - Database: if Oracle then give as usual JDB parameters


  • Or choose Configuration in preference. - make sure that the data store jar in the classpath and DB driver entry in the prconfig file.

  • Class and Table mapping: - Database table
  • Goto under Records explorer -> SysAdmin-> Click Database table
  • Pega will keep all data in a single row with blob format
  • Every class mapped to a data table
  • Every properties in a class mapped to a db column
  • PR PZ PV tables created in Pega with prefixes
  • PZ PV streams for Work Class tables
  • PR_Classname for Properties
  • PX created for activities, PY created for flows
  • PX and PZ are read-only you can't edit.
  • The default database is PgSql and PostGRESql installed
  • Class is connected to table and properties connected to columns in the table
  • PX and PZ work stream of Work classes table contain n no of properties

Data Table Creation in Pega:  (Data class + Table+ Properties + Column)

  • Data Explore -> add data type (data table) -> create new -> member details is name of data type
  • Advance -> choose org or implementation layer? -> applolo_data : Org data, applolo_ortho_care : implementation data. choose implementation data class and create.



Member Table Creation :

  • Until unless you creating properties table column will not be created. Property names & column names are same and both will be created in same time.
  • This is not page...so go to data model tab - > define each column (each properties with type.)
  • Come to records tab -> this is where you are going to enter data to database. click on 'configure source' -> only entering to the first time. here you have define the mandatory primary and secondary key for the table. second time 'configure source' will not display and you will enter the data . ->  tick the check box field for Key. you can enter one row of data if you want..just do this and submit the changes.. defining key is mandatory.



  • Next time if you want to enter more data .. just click on 
  • Data explorer -> click on data link you created -> click add a record link and enter your data

  • Data class created?
    • Now you can the data class created in Application -> class explorer
    • See a word -DATA- which indicates data class 
  • Under data model -> Property -> you can see property created for your data model



  • Data created? You can see in Data explorer.


  • You can see your table in PG sql : PR_table name


Open your database using PGadmin

  • C:/PRPCPersonaledition/PGsql/pgadmin4/bin/PGadmin4.exe-> just click that you will see the data base. Server should up and running so you can connect with your db ...



Notes:
- Blob tables are less memory consumption. It can be created when the table using only by your application.
- RDB tables reused by multiple applications (read only) - need more memory each data store in each row.
-  Reporting you need RDB tables..Store procedure and Function we need to go with RDB
- upstream -> data flowing
- downstream -> data who consuming
- Exposed means tables dedicated to every columns..

Create application in Pega 7.2

 

 


Application types in Pega

  1. Application Profiler - for B.A. non technical persons, to build visio diagram.
  2. Application Accelerator - Developer
  3. Application express - Infront application for demo

Steps:
  • Choose - (reusable) framework and Implementation.
  • Give objective of the application
  • Give Organisation name: BOA (name of organization layer)
  • Give class name 'Leave'
  • Give various Data type names (table name) - new table 'leaveBal' 
  • Your choice where you want to build the table whether in (organization enterprise org layer -) framework layer or implementation layer

Review:

Organisation layer.
 - work class (business layer)
 - Data class (for all data tables)
 - Integration class

(..We didn't give division layer)

Framework layer
 - Work class (business layer)
 - Data class (for all data tables)
 - Integration class
 - Implementation layer
 - Work class (business layer)
 - Data class (for all data tables)
 - Integration class

User
 - Access group
 - Access Role (Admin, manager, user)
 - Work Groups (group emails hold all email in particular group)
 - Work Baskets

Complete the wizard, Create the application  - 4 users with passwords created for the application.

- The application will be loaded.
- You can view operator details by clicking the top right corner,
- You can can change profile details, update the password.
- You can open rules - your application built on Pega rule.

Cases -> Leave

Records (only data) -> Oraganisation -> Operator id
Records -> Security -> Access group
Records -> Application -> id
App (explorer)-> find your class, and Rules

BOA Timeoff Work - class and child as below,

  • BOA. - Organisation layer classes
  • BOA-Data - Organisation data class
  • BOA.FW. - framework layer classes
  • BOA-FW-Data - framework layer data classes
  • BOA-TimeOff - Implementation layer classes
  • BOA-TimeOff-Data - Implementation data layer classes

Data (explorer)-> LeaveBal (table you can see)

If you choose BOA.TimeOff-Work -> you will see below

Case (explorer) -> you can see various type of cases of your application

Define the stage first

A stage is a collection of business processes. Stages represent show where a case is at any time during its process

Lifecycle - from creation to resolution. for example, a purchase request case can have these stages in this

Sequences.
1. Request
2. Vendor addition
3. Quote
4. Approval
5. Procurement
6. Closes

Case -> lifecycle -> add stages -> group a flow

1. Apply leave (Leave application stage), You can give SLA (Service Level Agreement)
2. Approvals
3. Notification

You can alternate stage by Actions -> Configure alternate stages

1. Rejected Notification (when approval rejected)

Done

Pega -Basics

Pega Basics:


What is Class Group?


  • Class Group is a combination of one or more abstract class
OCBC-OCBCAuto-OCBCWork
OCBC- (Org Abstract Class)
OCBCAuto- (Div Abstract Class)
OCBCWork (Unit Level Concreate Class) Inheriting from Work-
You are been applied with Pattern inheritance

Types of inheritance in Pega:

There are 2 types of inheritance available.
  • Direct Inheritance
  • Pattern Inheritance
1. Direct Inheritance
A class can have one and only one parent which is called the direct parent.
Direct parent of the class can be chosen from the drop-down Parent class (Directed)

2. Pattern Inheritance
Pattern Inheritance on a class can be applied by selecting the checkbox Find by name first (Pattern)
When we select the checkbox, the class will be applied by pattern inheritance.
OCBC-OCBCAuto-OCBCWork applied with pattern inheritance. PRBC trades OCBC-OCBCAuto parents classes to OCBCWork.

Pattern Inheritance has multiple parents.

The class group will be automatically created when we create a new application.

3. How to create a new application in Pega7?

A new application can be created from the 'New application wizard'. when we create new application it creates below

4. Components.

1. Application
2. Operator IDs with default password 'rules'
3. Class group

Steps

  • Login PRPC with administrator@pega.com/install
  • Click on the top menu and choose the new application
  • Application name - DBS Insurance Operation
  • Build on application - PegaRules
  • Organization name: DBS
  • Click on Next
  • Business objective: enter objective of you
  • Skip case type and Datatypes
  - Now it created with below operators,
1. administrator (Developer login),
2. DBA (Developer login)
3. Manager
4. User

- with default password 'rules'.

- It creates 'DBS insurance Operations' application

- Login with Admin@rules/rules

- Once we log in, click on application explorer which displays the class group.

- DBS-DBSINSURU-Work


4. Design a screen to capture customers basic information
  • First name 
  • Last name 
  • Age
  • Gender
  • phone number
  • email
  • address
5. To create a webpage, follow below steps

  • Step 1. Identify and create all the required properties.
  • Step 2. Design UI by creating 'Section', drag and drop the above-created properties on the layouts of section
  • Step 3. Create a flow action, call the above-created section into this flow action.
  • Step 4. Create a workflow, call the above-created flow action into the flow by using an assignment sheet
  • Step 5. Create a work object for the above-created flow, save the flow and run it
Step 1  Creating properties
  • A property can create under data-model category
  • Right click on data model, create -> data model - > property
  • Enter label name -> press create and open button -> accept in the default and click on Save
  • Create other properties in a similer way..

Step 2. Design User Interface by creating section.
  •  The section can be created under user interface catagory
  •  Right click on class group -> user Interface -> section
  •  Section name & configuration : section label : capture customer details -> click create and open
  •  How to align this control in the layouts and how to add a header text to the layout:
  •  Click on the layout to select it and click on view properties icon
  •  Layout format: inline format double
  •  Select the check to display header and title
  •  Write title in the text box and then submit the popup
  •  Click on save so section will be created.

Step 3 Creating flow action:

  •  Flow action can be created under the process category.
  •  Classgroup -> process -> flow action
  •  Config: capturing the customer details -> create
  •  Select the section from the drop down and save.

Step 4 : Creating a workflow:
  • Flow call the above created flow action into the flow by using an assignment sheet
Step 5. Create a work object for the above created flow, save the flow and run it

6. Implementation


Step1. Creating Properties

 A property can create under the data-model category

  • Right click on data model, create -> data model - > property
  • Enter label name -> press create and open button -> accept in the deaful and click on Save
  • Create other properties in a similar way

Step 2. Design User Interface by creating section.

  • The section can be created under user interface category
  • Right click on class group -> user Interface -> section
  • Section name & configuration : section label : capture customer details -> click create and open
  • You can check how to align this control in the layouts and how to add a header text to the layout:  click on ..

Step 3 Creating flow action:

  • Flow action can be created under process category.
  • class group-> create -> Progress -> Flow Action
  • Give the name of flow action : capturing the customer details

Step4 : Double click on out bold connector on assignment shape , it open a popup


Step 5 : Creating work object as below

  • Go the process on above flow , select check box create a new work object and save
  • Run the flow from action drop down.

Done.

Sunday, 20 October 2013

Iphone Interview Questions and Answers




 Multitasking support is available from which version?

iOS 4.0

What is a structure?

 A struct is a special data type C which encapsulates other data elements into a cohesive unit. As an object, but built in C.

Which iPhone OS?

iPhone OS running on the iPhone and iPod touch.

Hardware devices are managed by the iPhone OS and provides the necessary implementing native applications on the phone technologies.

The system comes with a variety of system applications such as Mail, Safari, Phone, which provide standard services to users
.

What is @interface?

- It’s a keyword used to declare the Class.

What is @implementation?

- It’s a keyword used to define the Class.


Garbage collector in iPhone?

- iOS 5.0 has got the ARC ( Automated reference counting ).  Objective C does not have a garbage collector rather it uses the reference counting algorithm to manage the memory. This was the developers task until Apple launched iOS 5.0. Again if you are targeting iOS 4.0 or earlier , ARC is no more a choice for you .


 What is delegate?

- Delegate is an object that handles the events happening on an object. To do that delegate has to follow a protocol specifying the task it is going to handle .



 What is @synthesize?

- We use @synthesize to generate getters and setters automatically from compiler. We declare properties and then generate getter and setter method by using @synthesize.


What are the features of iOS 5.0 ?

- https://developer.apple.com/technologies/ios5/


What is nonatomic ?

- nonatomic and atomic are related to multithreading environment .

 - If a property has an attribute as “nonatomic” that means multiple threads can modify that property concurrently.

- If the attribute is “atomic”, the threads would be given access atomically.

-  So “Atomic” is thread safe while “nonatomic” is thread unsafe.

- Atomic drastically hampers the performance so until and unless not needed you should never go for atomic attribute. ‘nonatomic ’ will do in most of the cases.


 What are the delegate methods of MKMapView ?

- Check the MKMapViewDelegate in the Documentation. If you don’t have Xcode with you then search on Google.

What are the important delegate methods of NSXML parser?


-DidStartElement

-FoundCharecters

-DidEndElement

-FoundError


What is @dynamic and any place where it is used ?

- It tells compiler that getter and setter are not implemented by the class but by some other class .

- May be super class or child class .



Example – Core Data

-       The Managed object classes have properties defined by using @dynamic.


What is @property?

- It is a keyword used to declare a property.



What is data source?

- The datasource is an object that implements the required datasource protocol that is needed to create a complex control.

Ex UITableView is a view that needs a datasource object to which will help building the table. Often it’s the controller that is displaying the table view. The protocol that dataSource object ( mostly controller it self) has to implement is “UITableViewDataSource” .


What is model view controller?

- MVC is a Design pattern .

Model stands for the database  object which will manage all the database transaction .

- View stands for the UI i.e. the UI visible to the user. User will be interacting with the view.

- Controller is an object who handles the view events and also render the database changes to the UI. In short , it bridges the interaction between Modal and View.

what is @ protocol?

- @protocol is a keyword used to define a protocol. A protocol is a set of method declarations defining specific purpose. It only lists out the methods prototype , the actual implantation would be provided by the class that implements /  follows the protocol.


what is id?

- id is a generic reference type. The variable declared using id data-type can hold any object. Most of the methods that returns an object has ‘id’ as return type. Ex – init.



Explain memory management?

- Most of the object oriented languages have the Garbage Collector .  All the objects are allocated on the heap memory. The Garbage Collector is a thread that runs periodically to check all the objects, which are no more being referenced from the program. Garbage collector then de-allocates all these unreferenced objects on the Heap. In this environment programmer does not need to worry about de-allocating the objects explicitly.



In Objective – C we don’t have garbage collector. ( Note: Its available from iOS 5.0 only). So in this environment we have to explicitly take care of allocation and deallocation of all the objects in our program.  And to manage this Objective C uses ‘reference counting’ algorithm as the memory management algorithm. 



Reference Counting: In this algorithm every object keeps track of it owners ( I,e reference variables from the program ) . No of owners is represented by the property retainCount declared in NSObject. If this retainCount goes to ‘0’ the object gets deallocated automatically.  We never call dealloc method on any object explicitly.

what is retain and release?

- retain and release are two method defined in NSObject . - -

- These methods are related to Memory Mangement .

- retain method when called increases the retainCount by 1.

- release method when called decreases the retainCount by 1

what is dealloc?

- dealloc method is called on an object to actually deallocate the memory for that object. ( We should never call dealloc directly )

- In reference counting environment when retainCount of an object reaches to ‘0’, the dealloc method is called on that object automatically to delete the memory space of the object .

- If the object is having some reference type variable holding other objects, then we should call release method on every variable in dealloc.

- If you override then [super dealloc] should be the last line in this method.





What is Autorelease pool?

-  Autorelease pool is like a container that holds the autoreleased objects .

- This pool is drained with every run-loop of the Application

- When the pool gets drained, autorelease pool sends a release message to all the objects it was holding.


What is Foundation Framework? Can you explain some classes from that?

- Foundation is one of the important frameworks in COCOA Touch.

- It contains the classes like  NSArray , NSString , NSObject etc .

What is the difference between NSArray and NSMutableArray?



* NSArray

-        is a static array

-       Once created you can not modify the array

-       Ex you can not add or remove the object in NSArray.



* NSMutableArray

-       is a dynamic array

-       You can add or remove the object dynamically.

Write a delegate method of the table view?

 - (void)tableView:( UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath





What are the delegate methods of NSURLConection?

- didReceiveResponse:

- didReceiveData:

- didFinishLoadingData:

- didFailWithError:





What is cocoa ?

- COCOA is a collection of frameworks used to write Applications for MAC OS X.


Singleton classes

- A singleton class is such a class from which no more that one instance can be created. So there will always be single instance created throughout the program.

Ex UIApplication.