i

Please enable JavaScript to view this site.

Documentation 8.5

The model class contains properties with their getters and setters, while the service class contains operations to be performed on the model.

 

For example, when downloading the Java sources of the process, if using the "Request Payment" process, a requestPayment.java file is generated with the model methods and also another requestPaymentService.java file with the available service operations.

Model Class Content

 

A case model contains:

 

Model constructor.

Getters and setters of the case properties.

Getters to get the related forms.

Getters to get the activities in progress.

Getters to get the process corresponding to the case.

 

Getters and setters of the case properties

 

The case model class contains a set of getters and setters for the case properties.

 

 

Operation

Description

Parameters

getCdCase()

Gets the identifier of the case.


setCdCase(casenumber)

Allows to set the case identifier value.

String casenumber: Case number

getCdState()

Gets the state of the case.

 

Possible values:

ACTIVE - Active

CANCELLED Cancelled

ENDEDCASE - Ended


getDsCase()

Gets the description of the case.


getDtEnded()

Gets the end date of the case.


getDtExpiration()

Gets the expiration date of the case.


getDtInitiated()

Gets the start date of the case.


getPriority()

Gets the priority of the case.

 

Possible values:

1 - Urgent

2 - High

3 - Medium

4 - Low


setLastPressedButton(button)

Allows to set the last button pressed.

String button: Name of the last button pressed.

getLastPressedButton()

Gets the last button pressed.


get + <Form class name> + Entity()

Gets an instance of the form class related to the process.


getLsVinculatedForms()

Gets a list of form instances related to the case.


getVinculatedFormByIdEntity(idEntity)

Gets a form instance related to the case.

String idEntity: Identifier of the form instance

getProcess()

Gets the process corresponding to the case.


getLsExecutedActivities()

Gets the executed activities of the case.


getLsCurrentActivities()

Gets the activities in progress of the case.


 

Getter to get the related forms.

 

Given a case, the values of the form fields related to it can be used, in the same way as if the activities were executed manually.

 

The model class has a getter for each form related to the process, with a “get + <Form class name> + Entity()” structure. Once an instance has been retrieved, it is used in the same way as for forms.

 

Example

If the "Request Payment" process related to the "Payment" and "Report" forms is modeled, the RequestPayment class has the following methods:

 

getPaymentEntity(): Gets an instance of the Payment class that corresponds to the "Payment" form related to the case.

 

getReportEntity(): Gets an instance of the Report class that corresponds to the "Report" form related to the case.

 

 

The case cannot have forms associated with the same class name, even if they belong to different applications.

 

Getters to get the activities in progress

 

Given a case, the list of its activities in progress can be accessed, using the getLsCurrentActivities() case properties method of the model class, which returns a list of "ExecutedActivity" objects with their methods.

 

 

Operation

Description

Parameters

getCdActivity()

Gets the code of the activity.


getDsNameActivity()

Gets the activity name.


getCdState()

Gets the state of the activity.

 

Possible values:

EXEC - In execution

CANCELLEDACT - Cancelled

ENDEDACT - Ended


getPriority()

Gets the activity priority.

 

Possible values:

1 - Urgent

2 - High

3 - Medium

4 - Low


getDtEnded()

Gets the end date of the activity.


getDtExpiration()

Gets the expiration date of the activity.


getDtInitiated()

Gets the start date of the activity.


getCdUserExec()

Gets the code of the user that executed the activity.


getCdUserInit()

Gets the code of the user that started the activity.


getNuDurationSeconds()

Gets the duration in seconds of the activity execution.


getTpActivity()

Gets the activity type.

 

Possible values:

TP_GATEWAY - Gateway

TP_STANDARD - Standard

TP_ABSTRACT - Abstract


getTpParticipant()

Gets the type of participant for the activity.

 

Possible values:

USER - User

ORG_UNIT - Organizational Unit

ROLE - Role

THING - Userthing

 


getLsExecutedActions()

Gets a list of actions executed by the activity.


 

Getter to get the process corresponding to the case.

 

A case process can be obtained through the getProccess() method of the model class, which returns an instance of the "Process" class with its methods.

 

 

Operation

Description

Parameters

getCdProcess()

Gets the code of the process.


getCdVersion()

Gets the version of the process.


getIdApplication()

Gets the application identifier of the process.


getCdFirstActivity()

Gets an Activity object with the first process activity,


getDsComment()

Gets the comment of the process.


getDsDescription()

Gets the description of the process.


getDsName()

Gets the name of the process.


 

Service Class Content

 

The service allows the following operations to be performed on the cases:

 

 

Operation

Description

Parameters

startCase(case)

 

 

 

 

startCase(case, user)

 

Starts a case, executing the initial activity of the related process. Returns the code of the created case.

 

Case case: Model of the case to start. Related form fields must have values

 

 

Case case: Model of the case to start. Related form fields must have values

 

String user: Code of the user that executes the activity. It must be specified when the participant responsible for the activity is a role

startCase(case. moveCase)

 

 

 

 

 

 

 

startCase(case, user, moveCase)

 

 

Starts a case, with the possibility of not executing the initial activity of the related process. Returns the code of the created case.

 

 

Case case: Model of the case to start. Related form fields must have values

 

Boolean moveCase: Configure with false value, to indicate that it does not have to execute the initial activity of the process

 

Case case: Model of the case to start. Related form fields must have values

 

String user: Code of the user that executes the activity. It must be specified when the participant responsible for the activity is a role

 

Boolean moveCase: Configure with false value, to indicate that it does not have to execute the initial activity of the process

execute(case)

 

 

execute(case, user)

Executes the current activity of a case.

Returns the state of the updated case.

Case case: Model of the case with assigned case number

 

 

Case case: Model of the case with assigned case number

 

String user: Code of the user that executes the activity. It must be specified when the participant responsible for the activity is a role

execute(case,activity)

 

 

 

 

 

 

execute(case,activity,user)

 

 

 

Executes the activity of a case indicated in the parameter.

Returns the state of the updated case.

 

 

Case case: Model of the case with assigned case number

 

ExecutedActivity activity: Activity retrieved from the list of activities in progress of the case

 

 

Case case: Model of the case with assigned case number

 

ExecutedActivity activity: Activity retrieved from the list of activities in progress of the case

 

String user: Code of the user that executes the activity. It must be specified when the participant responsible for the activity is a role

read(case)

Reads a case.

Case case: Model of the case with assigned case number

cancelCase(case, observation)

Cancels a case.

Case case: Model of the case with case number to be cancelled. Cancellation is done with the online user executing the sdk rule

 

String observation: Reason for cancellation

reassignCase(case, reassignUser)

 

Assigns the case task in execution.

Case case: Case model with case number assigned to the task

 

String reassignUser: Code of the user to whom the case task is assigned

reactivate(case)

Reactivate a canceled case.

Case case: Model of the case with case number to be reactivated.

 

Examples of Use

 

The examples use the “Request Payment” process and each example contains the use of the “RequestPayment” model class and the “RequestPaymentService” service class.

 

In addition, “Request” and “Report” classes are used, which represent models of forms related to the “Request Payment” process.

 

The examples detail how to start a case, read it, execute and assign its activities, finish it and cancel it.

 

Process Diagram for Examples 1 to 7

 

 

CM0050~1_img1

 

 

1.Starting a case

 

To start the case, the first activity "Fill Request" is executed. The case moves to the “Evaluate Request” activity under the liability of “Afarias” user, configured in the “Authorizer” lane.

 

Executing the “Fill Request” activity performs the “Create” operation on the “Request” form with the values assigned to its fields.

 

An instance of the "RequestPayment" model class is created, in the "Request" form obtained through the getRequestEntity() method, values are assigned to its fields with the corresponding setters. The case is started using the "RequestPaymentService" service class with the startCase(myFirstPaymentCase) method.

 

 

RequestPayment myFirstPaymentCase = new RequestPayment();

myFirstPaymentCase.getRequestEntity().setAmount(new Double(200));

 

SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");

myFirstPaymentCase.getRequestEntity().setDueDate(new Date(format.parse("2020-06-28").getTime()));

myFirstPaymentCase.getRequestEntity().setMessage("This is my first payment request .. i need to buy more coffee !!");

 

RequestPaymentService myService = new RequestPaymentService(getApiClient());

String cdCase = myService.startCase(myFirstPaymentCase);

 

 

 

2.Starting a case without executing the first activity

 

The process of Example 1 is used.

The case starts using the “RequestPaymentService” service class with the startCase(case.moveCase) method with the second parameter set to false so that it does not execute the first activity “Fill Request”.

 

 

RequestPaymentService myService = new RequestPaymentService(getApiClient());

String cdCase = myService.startCase(myFirstPaymentCase,false);

 

 

 

3.Reading the case

 

An instance of the “RequestPayment” model class is created, it is assigned a case number generated by the startCase(myFirstPaymentCase) method of the “RequestPaymentService” service class, in the previous example.

 

The case is read with the read(myFirstPaymentCase) method of the "RequestPaymentSercice" service class and the case number.

 

 

RequestPayment myPaymentCase = new RequestPayment();

myPaymentCase.setCdCase(cdCase);

myPaymentCase = myService.read(myFirstPaymentCase);

 

 

 

4.Activity execution that defines modeled buttons

 

The case is in the “Evaluate Request” activity, which has two modeled buttons. The next activity to be executed depends on the button selected, in this example “Approve” is selected. If no button is specified, the modeled flow is followed as default.

 

The “Approve” button is assigned to the “Request Payment” model class using the corresponding setter. The “Evaluate Request” activity is executed with execute(myPaymentCase) method of the “RequestPaymentService” service class.

 

As a result, the case is in the “Fill Report” activity and its state is “ACTIVE”,

 

 

myPaymentCase.setLastPressedButton("Approve");

myService.execute(myPaymentCase);

 

 

 

5.Activity execution not defining modeled buttons

 

The case is in the “Fill Report” activity. This activity execution creates the “Report” form. This form has a field called "request" that is related to the "Request" entity.

 

The “request” field is completed by means of the corresponding setter, with the identifier of the “Request” entity related to the case, which is obtained by means of the getRequestEntity() method.

 

The rest of the fields are completed and the “Fill Report” activity is executed with the execute(myPaymentCase) method of the “RequestPaymentService” service class.

 

The case is sent to the “Request approved” end event and its state is ended.

 

 

Integer requestId = myPaymentCase.getRequestEntity().GetRequestId();

 

myPaymentCase.getReportEntity().setRequest(requestId.toString());

myPaymentCase.getReportEntity().setPaymentMethod("Credit");

myPaymentCase.getReportEntity().setSummary("Filling the report using the SDK.");

myService.execute(myPaymentCase);

 

 

6.Cancellation of a case

 

An instance of the “RequestPayment” model class is created, it is assigned the case number to be canceled.

The cancellation reason is entered in the “observation” parameter and the case is canceled with the cancelCase(myPaymentCase, observation) method of the “RequestPaymentService” service class.

 

 

RequestPaymentService myService = new RequestPaymentService(getApiClient());

RequestPayment myPaymentCase = new RequestPayment();

myPaymentCase.setCdCase("0000000091120000");

myService.cancelCase(myPaymentCase,"Duplicate case");

 

 

7.Assignment of the task in execution of a case

 

An instance of the “RequestPayment” model class is created, indicating the case number to which the task is assigned.

The user code is entered in the "reassignUser" parameter and the task is assigned with the reassignCase(myPaymentCase, reassignUser) method of the "RequestPaymentService" service class.

 

When the task of a case is assigned, the online user that executes the sdk rule is used. This user can assign their own tasks, those of their team and those of the participants of a role, if they were their coordinator.

 

 

RequestPaymentService myService = new RequestPaymentService(getApiClient());

RequestPayment myPaymentCase = new RequestPayment();

myPaymentCase.setCdCase("0000000091120000");

myService.reasignCase(myPaymentCase,"JPEREZ");");

 

 

8.Reactivation of a canceled case

 

An instance of the “RequestPayment” model class is created, and the canceled case number is assigned to it.

The case is reactivated with the reactivate(myPaymentCase) method of the “RequestPaymentService” service class.

 

 

RequestPaymentService myService = new RequestPaymentService(getApiClient());

RequestPayment myPaymentCase = new RequestPayment();

myPaymentCase.setCdCase("0000000091120000");

myService.reactivate(myPaymentCase);");

 

Process Diagram for Example 9

 

 

EjemploProcesoCasoSDK

 

 

9.Execution of a specific activity

 

Activities "Evaluate request" (9) and "Evaluate manager request" (11) are sent to be evaluated by two authorizers.

Activity "Evaluate manager request" (11) is executed. JPAZ user is the authorizer and rejects the activity in this case.

 

An instance of the “RequestPayment2Authorizer” model class is created, a case number to be read is assigned.

The case is read with the read(xMyCase) method of the "RequestPayment2AuthorizerSercice" service class and the case number.

 

Every activity in progress is retreived with the getLsCurrentActivities() method and an ExecutedActivity object is instantiated.

If the activity is "Evaluate manager request" (11), the “Reject” button is assigned through the corresponding setter and the activity is executed with the execute(xMyCase. xActivity, user) method of the “RequestPayment2AuthorizerService” service class.

 

 

RequestPayment2AuthorizerService xRequestPaymentService = new                   RequestPayment2AuthorizerService(getApiClient());

RequestPayment2Authorizer xMyCase = new RequestPayment2Authorizer();

 

xMyCase.setCdCase(idCase);

xMyCase = xRequestPaymentService.read(xMyCase);

 

for (int i = ; i < xMyCase.getLsCurrentActivities().size(); i++) {

    ExecutedActivity xActivity = xMyCase.getLsCurrentActivities().get(i);

 

    if (xActivity.getCdActivity()== 11 [);i

()                         xMyCase.setLastPressedButtom("Reject");

       xRequestPaymentService.execute(xMyCase, xActivity, "JPAZ" );

}       }

      }

Search

 

Case searches of a process can be performed through the interaction of the following objects.

 

Criteria: represents search criteria on case data. It is made up of elements that can be properties and values, connected by operators.

 

 

Property Identifier

Description

Case.searchCdState

Case state

Case.searchPriority

Case priority

Case.searchDsCase

Case description

Case.searchDtInitiated

Case start date

Case.searchDtEnded

Case end date

Case.searchCdActivity

Activity code

Case.searchCdCase

Case number

 

 

Operator

Description

eq

Equal

gt

Greater

lt

Less

betweene

Between and admits equals

like

Contain

 

 

Possible values of the case state:

 

Identifier

Description

Case.stateActive

Active

Case.stateCancelled

Cancelled

Case.stateEnded

Finalized

 

 

Possible values of the case priority:

 

Identifier

Description

Case.priorityUrgent

Urgent

Case.priorityHigh

High

Case.priorityMedium

Medium

Case.priorityLow

Low

 

 

SearchCriteria: object that groups search criteria (Criteria object), it also allows parameterizing the order of the result, the size of the reading page and the number of pages to be retrieved. Reading by pages is used since the data volume on a process can be very large.

 

Process Service: service class of the process on which the case search is being carried out. Contains the search(searchCriteria) operation that must receive the SearchCriteria object as a parameter and returns the SearchResult object.

Example:

SearchResult searchResult = actionsService.search(searchCriteria);

 

SearchResult: object that contains the search results. Contains a list of the process cases, for example “Actions”. This object allows to know the total number of reading pages resulting from the search, the size of each page and the number of pages to retrieve.

Search Examples

 

1. Search

 

This example retrieves a list of cases from the “Actions” process with an active state, where the state property corresponds to the “Case.searchCdState” identifier and the active value corresponds to the “Case.stateActive” identifier. The number of pages to retrieve is also defined.

 

 

AccionesService xaccionservice = new AccionesService(getApiClient());

SearchCriteria searchCriteria = new SearchCriteria();
Criteria criteria1 =
          Criteria.eq(Case.searchCdState,Case.stateActive);
searchCriteria.addCriteria(criteria1);
searchCriteria.setPage(1);
 
SearchResult searchResult =
             xaccionservice.search(searchCriteria);
List<Acciones> instancesResult = searchResult.getResult();
 

 

 

2. Constructor types for search criteria

 

This example creates a Criteria object and defines different search conditions using the "between and admits equals", "contains" and "greater" operators.

 

 

 

// Between and admits equals. Dates must be in year-month-day format.

// SearchCriteria searchCriteria = new SearchCriteria();

// SimpleDateFormat format =
//      new SimpleDateFormat("yyyy-MM-dd");
// Date dateFrom =
//      new Date(format.parse( "2020-01-01" ).getTime());
// Date dateTo =
//      new Date(format.parse( "2021-01-01" ).getTime());

//
// criteria  criteriaDate =  Criteria.betweene(Case.searchDtInitiated,
// DateFrom, DateTo);

// searchCriteria.addCriteria(criteria Date);

 
// Contains. The case description contains the test word
// Criteria criteriaLike = Criteria.like(Case.searchDsCase,"test");

 
// Greater. Case number greater than 80
// Criteria criteria = Criteria.gt (Case.searchCdCase, "80") ;

 

 

 

Deyel uses the data type java.sql.Date for "date" type fields, so the transformation from java.util.Date to java.sql.Date must be done, when it is required to create an object with this type of data.

 

 

3. Operations on the results object

 

The SearchResult object is an iterative object and as such can be scrolled through in different ways.

The example uses a FOR statement to iterate over the cases that meet the search conditions of example 1 (active state), retrieving the case start date and priority.

 

 

AccionesService xaccionservice = new AccionesService(getApiClient());

SearchCriteria searchCriteria = new SearchCriteria();

// Cases with active state

Criteria criteria1 = Criteria.eq(Case.searchCdState,"ACTIVE");

    searchCriteria.addCriteria(criteria1);

    searchCriteria.setPageSize(10);

    searchCriteria.setPage(1);

 

    SearchResult searchResult = xaccionservice.search(searchCriteria);

 

    List <Case>instancesResult = searchResult.getResult();

    // Loop through the list of cases

    String log = "";

    for (Case cases :instancesResult){

        log = cases.getDtInitiated() +" - "+ cases.getPriority();

    }

 

Send us your comments
Share on X Share on Linkedin Send by Email Print