Attribute settingers for entity objects and view objects in EBS oaf Development

Source: Internet
Author: User

Attribute settingers for entity objects and view objects in EBS oaf Development

(Copyright statement: If your original or translated articles need to be reprinted, or if they are used for personal learning, please indicate the source; otherwise, please contact me. violators must investigate)

Source Text:

Home> Oracle Application Framework documentation set, release 12.2> Oracle Application Framework developer's guide> Chapter 5: Implementing server-side features> entity object and view object attribute setters


Overview

In oracle. apps. FND. framework. server. OA entityimpl and Oracle. apps. FND. framework. server. there are many methods in the oaviewrowimpl class that allow you to set attribute values for object and view objects during programming. This document explains each feasible option and recommends appropriate use in different scenarios.

Note: it does not explain how to set object and view object attribute values in a declarative manner. See defaulting in implementing the view

Content

This document consists of two main parts:

L attribute values cached on the view object

L attribute values cached on the object

Prerequisites.

L Java object

L view object details-view object attribute type and cache (learn about different view object attribute types)

Attribute values cached on the view object

Method Overview

For attributes stored in the view object Layer (they are not mapped to object attributes), you can use the oaviewrowimpl method below to set the attribute values.

Method 1: setattribute ()

1. setattribute (string name, object Val)
2. setattribute (INT index, object Val)

These two methods will execute all the programming verifications you define for them, and then in the super. in setattribute (), they use the search mechanism to find and call the relevant set <attributename> () method (note that you must call Super after your code. setattribute ()).

3. Set <Attributename> () // Attribute Setter in oaviewrowimpl subclass

This method will execute all the programming verifications you have defined for this method, and then call the method setattributeinternal (). Note that you must call the setattributeinternal () method after your code.

These three methods mark the query set of the dependent view object as "dirty" (after you call them, the method oaviewobjectimpl. isdirty () returns true ). for more information about isdirty () check, see advanced view object developmenttopics-> entity event notification.

Method 2: setattributeinternal ()

1. setattributeinternal (INT index, object Val)

This method performs all declarative verifications specified for the view object attribute in the view object XML file. And

The setattribute () method is the same. This method also marks the query set of the dependent view object as "dirty.

Because this method only performs declarative verification, you should not overwrite it (you do not need to do this because it should not contain programmatic verification); you should simply call it as needed.

Method 3: "populate" Methods

1. populateattribute (INT index, objectvalue)
2. populateattributeaschanged (INT index, object value)

These methods set values for the attribute, but do not perform any verification or affect the "dirty" mark of the view object query set.

Do not overwrite this method and add programming verification code to the populate * method, because these methods are used to set values for attributes simply.

Note: For object Layer attributes, the populateattributeaschanged (intindex, object Value) method has different behaviors. For details, refer to the "attribute values cached on Object" section below.

The following example shows how to use this method to set the value of the table selector without affecting the view object status.

public void setSelectFlag(String value){ //Do not call setAttributeInternal as usual in this method. // setAttributeInternal(SELECTFLAG, value); populateAttribute(SELECTFLAG, value); } 


Behavior Summary

L The Set * method verifies and marks the "dirty" state of the query set of the view object. Populate*The method is simple to set the value without any verification or changing the view object status.

Use note

Use Basic settings (option 1) should be used as a rule unless you have the following special circumstances:

L if you need to ignore programming verification and only call declarative verification, you need to use setattributeinternal (intindex, object Val) instead.

L set an attribute value without triggering verification or affecting the "dirty" Status of the query set of the view object. Use the populateattribute (intindex, object Value) method. for example, as shown above, you may overwrite the seter method of the "selector" attribute of a table bean to use the populateattribute () method. This allows you to store a specific UI state without changing the VO state. For more information about "selector", see tables-classic and tables-advanced.

Note: Do not use the populate * method to set the primary key attribute values (this may have adverse consequences for the composite relationship ). The primary key attribute should be used as the basic setter.

 

Attribute values cached on Object

For attributes stored in the object Layer (they are not mapped to object attributes), you can use the following method in oaentityimpl to set the attribute values.

Note: In most cases, you usually call methods described above oaviewobjectimpl and oaviewrowimpl to set object values (the VO method eventually acts as a proxy for potential object methods ). When writing code in your entityimpl subclass, however, you can call the following method to directly set the object property value.

When you call an object method such as set <attributename> (), your call will affect the following object state:

L validationstate-you can call it to perform the entientityimpl. isvalid () Check.

L submission status (poststate)-you can call it to perform the entientityimpl. getpoststate () Check.

L transaction state (transactionstate) can be called to perform the entientityimpl. getentitystate () Check.

Because bc4j maintains these additional States for the object (In addition, the basic "dirty" State maintained for the view object), The oaentityimpl method fine-grained controls on how to set attribute values.

Method Overview

Method 1: setattribute ()

1. setattribute (string name, object Val)
2. setattribute (INT index, object Val

These two methods will execute all the programming verifications you define for them, and then in the super. in setattribute (), they use the search mechanism to find and call the relevant set <attributename> () method (note that you must call Super after your code. setattribute ()).

3. Set <Attributename> () // Attribute Setter in oaentityimpl subclass

This method will execute all the programming verifications you have defined for this method, and then call the method setattributeinternal (). Note that you must call the setattributeinternal () method after your code.

The three methods mark the object as invalid and change the submission status and Transaction Status of the object as status_new or status_modified as needed, so that bc4j knows that the object has uncommitted changes.

Finally, these three methods will mark the query set of the dependent view object as "dirty. (After you call them, the method oaviewobjectimpl. isdirty () returns true)

Method 2: setattributeinternal ()

1. setattributeinternal (INT index, object Val)

This method performs all declarative verifications specified for object attributes in the XML file of the view object. And

The setattribute () method is the same. This method also marks the dependent object as invalid, changing the commit and transaction statuses, the query set of the dependent view object is also marked as "dirty.

Because this method is used to only perform declarative verification, you should not overwrite it (you do not need to do this because it should not contain programmatic verification ); you should call it as needed.

Method 3: "populate" Methods

Before looking at each separate method, let's take a look at the description of the parameters that can be used in most populate * methods.

Method Parameter

Description

Sendnotification

Controls whether to broadcast the event of changing object property values to the dependent view object. Changing the event will run the view object query set status ("dirty" Mark). For more information, see advanced view object development topics-> entity Event Notification

Markaschanged

When this parameter is setTrueThis attribute is marked as changed.

  • Bc4j submits modified persistent attributes during the DML stage, but only when the object's submission status isStatus_new or status_modifiedTherefore, insert a piece of heart data or call the following method to change the attribute values setattribute (), setattributeinternal (), or set <attributename> ()

Saveoriginal

Control whether bc4j saves the value originally obtained from the database to an additional place before changing the value.

If you want to save the original value:

  • Bc4j compares the original value with the value in the database column (locking) to check whether the value has expired.
  • Bc4j saves the original value. When the submission fails, these actions can be attempted again after the user corrects the verification error.

If the original value is not saved, the current attribute value will be used by bc4j to perform these operations.

1. populateattribute (INT index, objectvalue)

The behavior of this method is the same as that of the following call:

Populateattribute (index, value,
False, // sendnotification
False, // markaschanged
False); // saveoriginal

 

2. populateattributeaschanged (INT index, object value)

The behavior of this method is the same as that of the following call:

Populateattribute (index, value,

False, // sendnotification

True, // markaschanged

False); // saveoriginal

3. populateattribute (INT index, objectvalue,
Booleansendnotification,
Booleanmarkaschanged)

This method is no longer recommended. It calls populateattribute (index, value, sendnotification, markaschanged, false ).

4. populateattribute (INT index, object value,
Booleansendnotification,
Booleanmarkaschanged,
Booleansaveoriginal)

L you should not overwrite these methods and add programming verification logic, because these methods are used to set attribute values.

L these methods do not affect the validation status, commit status, or transaction status of the object.

L The "dirty" mark of the query set of the view object can be affected by the sendnotification flag value.

Recommended parameter value

L for oaf applications, if sendnotification is set to false, the dirty mark of the query set of the view object will not be affected by your modification. When the query set of the view object is corrupted, similar sorting operations in the table are not allowed (for more information, see tables-classic and tables-advanced ).

L set markaschanged to true. If you want to submit the attribute value and other user modifications to the database during DML.

L if you set markaschanged to true, set saveoriginal to true. as a rule, it helps to properly lock and handle submission failures. If you plan to submit the modified attribute values to the database, the saveoriginal parameter should be set to true.

Behavior Summary

L The Set * method verifies and marks the object as invalid, changes the submission status of the object, changes the Transaction Status of the object, and marks the view object query set as dirty.

L populate*The method is simple to set the value without any verification or changing the state of the object. However, the view object query set status (including dirty tags) is affected by the value of sendnotification.

Use note

Use Basic settings (option 1) should be used as a rule unless you have the following special circumstances:

L if you need to ignore programming verification and only call declarative verification, you need to use setattributeinternal (intindex, object Val) instead.

L it is not encouraged to use the populate * method for object. However, there are some exceptions that you need to use. The following describes these use cases, there are also different suggestions for Attribute types (if you are not familiar with the names of these types, refer to viewobjects in detail-view object attribute types and caching ).

Note: For Java object, do not use the populate * method to set the primary key attribute value (which may have adverse consequences for the composite relationship ). The primary key attribute should be used as the basic setter. For more information about PL/SQL entity objects with the "Refresh Insert" behavior, see PL/sqlentity objects-creating primary keys.

Do not use the populateattributeaschanged (intindex, object Value) method for Attribute types of all object origins, unless you really don't care whether you can resubmit the object after the submission fails (because of the populateattributeaschanged () methodSaveoriginal = false).

Persistent attributes of object Origins

For persistent attributes of view origins, you do not need to call the populate * method in most cases. Set the default values of these attributes for a new row. A better way is to use the basic setter method and then call oaviewrowimpl. setnewrowstate (row. status_initialized) method to use this line as a "temporary" until the user modifies it. For more information, see view object state management codingstandard M69.

Exceptions:

1. To implement the PL/SQL entity object that refreshes the insert behavior, you need to call the populateattribute (index, value, false) method. Before commit after the DML operation, this is required to synchronize the attribute values and database values immediately. For more information, see PL/sqlentity objects-creating primary keys.

2. if you want to set the attribute value for the object's origin so that it can be committed together with the value modified by other users without triggering verification or affecting the validation, submission, or transaction status of the object, or the dirty mark of the object query set. For example, the oaf framework sets the standard WHO field and objectversionnumber attribute values in this way.

Non-persistent attribute of object Origin

For non-persistent attributes of object origins, you should calculate and return values in the getter (get <attributename> () method of Object Attributes instead of setting values.

L if you cannot use this method for some reason, you can still use the basic configurator method-but note that these calls will change the entity object verification, dirty tag of the submission and transaction status and view object query set. You must also understand that you should not store any UI State to a non-persistent attribute of the object's origin.

Note: When the row set of the view object is refreshed after submission, the non-persistent attribute value of the object origin is lost. If you want to retain these values, see persisting entity-derived transientattribute values after commit.

L instead of using basic seters, you can use populateattribute (index, value, false, true, true) (set the value of markaschanged to true) to avoid triggering verification or affecting entity object verification, commit or transaction status, or dirty tag of the view object query set.

Note: non-persistent attribute values are not mapped to any database table, so they are not submitted. You must also understand that you should not store any UI State to a non-persistent attribute of the object's origin.

L avoid using the populateattribute (intindex, object Value) or populateattribute () method with the markaschanged parameter set to false.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.