Previous Topic: Review Generated Action DiagramsNext Topic: Review Generated PAD for READ


Review Generated PAD for CREATE

The generated create Action Diagram creates an occurrence of the entity type you specify during Process Synthesis. In addition, it may create or read related entity types as specified in data navigation.

The following example shows a generated Process Action Diagram for CREATE CUSTOMER:

CREATE_CUSTOMER
IMPORTS:...
EXPORTS:...
LOCAL:
ENTITY ACTIONS:...
CREATE customer
SET name TO input customer name
SET number TO input customer number
SET address TO input customer address
SET city TO input customer city
SET state TO input customer state
SET zip TO input customer zip
WHEN successful
MOVE customer TO output customer
WHEN already exists

Import, export, and entity action views are present, indicated by ellipses (...). Local views are not included; you must add them as needed for business rules and specific implementations. In this example, all views represent the subject entity type CUSTOMER. Views of any related entity types do not appear in the example of the Generated CREATE CUSTOMER Process Action Diagram because those entity types were not selected during Process Synthesis.

The MOVE statement after the WHEN successful exception logic executes only if the create succeeds. By moving import to export after execution of the process, the keyed input displays as output on the original screen only if the process succeeds.

The exception logic following WHEN already exists contains no action statements when the process is generated. You may want to add statements to handle this case. Action statements you add after WHEN already exists execute if an entity type with the same identifier has already been created.

Multiple associations and related entity types are shown in the example of a generated Process Action Diagram for CREATE CUSTOMER ORDER.

CREATE_CUSTOMER_ORDER
IMPORTS: Group View group_import
Entity View import customer_order
Entity View import customer
EXPORTS: Group View group_export
Entity View export customer_order
Entity View export customer
LOCAL:
ENTITY ACTIONS: Entity View customer_order_line
Entity View product
Entity View customer_order
Entity View customer
READ customer
WHERE DESIRED customer number IS EQUAL TO input
customer number
WHEN successful
MOVE customer TO output customer
CREATE customer_order
ASSOCIATE WITH customer WHICH places IT
SET number TO input customer_order number
SET date TO input customer_order date
SET status_code TO input customer_order status_code
SET confirmed_date TO input customer_order confirmed_date
SET time TO input customer_order time
WHEN successful
MOVE customer_order TO output customer_order
FOR EACH supplied
TARGETING
READ product
WHERE DESIRED product number IS EQUAL TO input
product number
WHEN successful
MOVE product TO output product
CREATE customer_order_line
ASSOCIATE WITH product WHICH ordered_on IT
ASSOCIATE WITH customer_order WHICH contains IT
SET number TO input customer_order_line number
SET quantity TO input customer_order_line quantity
SET requesting_unit TO input customer_order_line
requesting_unit
SET status_code TO input customer_order_line status_code
WHEN successful
MOVE customer_order_line TO output customer_order_line
WHEN already exists
WHEN not found
WHEN already exists
WHEN not found

The import, export, and entity action views show views of the subject entity type and related entity types.

The expression in the READ statement is the identifying attribute of the input view of the related entity type. If multiple identifying attributes are specified for the entity type, they also appear in the READ statement.

Generated Process Action Diagrams can handle any number of related entity types. For each related entity type, Process Synthesis generates the necessary views, READ (or CREATE), and ASSOCIATE statements. In fact, the CREATE action block appears under the WHEN successful branch of the READ for the related entity type. The second exception branch of the READ statement is WHEN not found.

The create action block uses SET statements to set the attributes of the entity action view to the corresponding input attributes, if the attributes are basic or designed.

You can add exception logic in this diagram or wait to add it during Design, after Process Synthesis. If the exception logic requires the execution of another process, you may want to wait until Design, when you can specify dialog flows and define exit states.