Skip to main content
Last updated January 07, 2014 07:53, by steven.davelaar
Feedicon  
<h2>ADF Samples - Validation and Business Rules</h2> [[ADFSamples | Main Table of Contents]] {| border="1" |- | <span id="ABA290"/>[[#ABA290|ABA290]] | [https://jdevsamples.googlecode.com/files/DynamicMandatoryAttrApp.zip Controlling ADF BC Mandatory Attribute Validation Conditionally] {12.1.2.0.0] 24-NOV-2013 [http://andrejusb.blogspot.com/2013/11/controlling-adf-bc-mandatory-attribute.html [[image:info.png]]] |- | <span id="ABA249"/>[[#ABA249|ABA249]] | [https://jdevsamples.googlecode.com/files/ADFValidationErrorApp.zip Duplicate Validation Error Message and ADF Bindings] {11.1.2.4.0] 02-MAY-2013 [http://andrejusb.blogspot.com/2013/05/duplicate-validation-error-message-and.html [[image:info.png]]] |- | <span id="ABA237"/>[[#ABA237|ABA237]] | [https://jdevsamples.googlecode.com/files/BeforeCommitVOApp.zip Coding Validation in ADF BC View Object Before Commit Method] {11.1.2.3.0] 21-MAR-2013 [http://andrejusb.blogspot.ca/2013/03/coding-validation-in-adf-bc-view-object.html [[image:info.png]]] |- | <span id="ABA222"/>[[#ABA222|ABA222]] | [http://jdevsamples.googlecode.com/files/CreateSequenceApp.zip How To Implement Gapless Sequence in ADF BC] {11.1.2.3.0] 18-JAN-2013 [http://andrejusb.blogspot.com/2013/01/how-to-implement-gapless-sequence-in.html [[image:info.png]]] |- | <span id="ABA216"/>[[#ABA216|ABA216]] | [http://jdevsamples.googlecode.com/files/ConditionalValidationApp.zip Conditional Validation in ADF BC] {11.1.2.3.0] 24-DEC-2012 [http://andrejusb.blogspot.com/2012/12/conditional-validation-in-adf-bc.html [[image:info.png]]] |- | <span id="ABA215"/>[[#ABA215|ABA215]] | [http://jdevsamples.googlecode.com/files/TabsValidationApp.zip Skip Validation for ADF Required Tabs] {11.1.2.3.0] 21-DEC-2012 [http://andrejusb.blogspot.com/2012/12/skip-validation-for-adf-required-tabs.html [[image:info.png]]] |- | <span id="ABA203"/>[[#ABA203|ABA203]] | [http://jdevsamples.googlecode.com/files/ViewAccessorSampleApp.zip ADF BC View Accessor To Centralize Business Logic Processing] {11.1.2.3.0] 09-NOV-2012 [http://andrejusb.blogspot.com/2012/11/adf-bc-view-accessor-to-centralize.html [[image:info.png]]] |- | <span id="ABA197"/>[[#ABA197|ABA197]] | [http://jdevsamples.googlecode.com/files/EOValidationApp.zip Transaction Level ADF BC Entity Validation] {11.1.2.3.0] 22-OCT-2012 [http://andrejusb.blogspot.com/2012/10/transaction-level-adf-bc-entity.html [[image:info.png]]] |- | <span id="ABA190"/>[[#ABA190|ABA190]] | [http://jdevsamples.googlecode.com/files/AutoPPRApp.zip What To Do When ADF Editable Table Misbehaves] {11.1.2.2.0] 09-SEP-2012 [http://andrejusb.blogspot.com/2012/09/what-to-do-when-adf-editable-table.html [[image:info.png]]] |- | <span id="ABA187"/>[[#ABA187|ABA187]] | [http://jdevsamples.googlecode.com/files/MasterDetailGroovyValidationApp.zip New Record Master-Detail Validation and ADF BC Groovy Use Case] {11.1.2.2.0] 26-AUG-2012 [http://andrejusb.blogspot.com/2012/08/new-record-master-detail-validation-and.html [[image:info.png]]] |- | <span id="ABA169"/>[[#ABA169|ABA169]] | [http://jdevsamples.googlecode.com/files/ADFModelValidationApp.zip ADF 11g R2 Model Layer Validation Functionality] {11.1.2] 30-MAY-2012 [http://andrejusb.blogspot.com/2012/05/adf-11g-r2-model-layer-validation.html [[image:info.png]]] |- | <span id="JPU078"/>[[#JPU078|JPU078]] | [http://adf-samples.googlecode.com/files/TxnlLevelValidateSample.zip Validating The Entity Collection When You Commit the Transaction] {11.1.2.1] 09-OCT-2011 [http://jobinesh.blogspot.in/2011/10/validating-entity-collection-when-you.html [[image:info.png]]] |- | <span id="ABA121"/>[[#ABA121|ABA121]] | [http://jdevsamples.googlecode.com/files/ADFMasterDetailImpl.zip Difference Between Fetched Row Count and Just Row Count] {11.1.1.x] 28-AUG-2011 [http://andrejusb.blogspot.com/2011/08/difference-between-fetched-row-count.html [[image:info.png]]] |- | <span id="ABA116"/>[[#ABA116|ABA116]] | [http://jdevsamples.googlecode.com/files/UniqueKeyADFSample.zip Unique Key Validation for LOV Based on Reference Attribute] {11.1.1.x] 11-JUL-2011 [http://andrejusb.blogspot.com/2011/07/unique-key-validation-for-lov-based-on.html [[image:info.png]]] |- | <span id="JPU051"/>[[#JPU051|JPU051]] | [http://adf-samples.googlecode.com/files/DMLBeforeCommit.zip Updating supporting business data before committing the transaction] {11.1.1.3] 24-DEC-2010 [http://jobinesh.blogspot.in/2010/12/updating-supporting-business-data.html [[image:info.png]]] |- | <span id="JPU044"/>[[#JPU044|JPU044]] | [http://adf-samples.googlecode.com/files/UpperCaseSample.zip Converting user input to uppercase] {11.1.1.3] 03-NOV-2010 [http://jobinesh.blogspot.in/2010/11/converting-user-input-to-uppercase.html [[image:info.png]]] |- | <span id="JPU043"/>[[#JPU043|JPU043]] | [http://adf-samples.googlecode.com/files/GlasspaneApp.zip Preventing user input on a fusion web page when the server is busy] {11.1.1.3] 15-OCT-2010 [http://jobinesh.blogspot.in/2010/10/preventing-user-input-on-fusion-web.html [[image:info.png]]] |- | <span id="ABA054"/>[[#ABA054|ABA054]] | [http://jdevsamples.googlecode.com/files/CustomGenericValidator.zip Implementing Custom Generic PL/SQL Validator in Oracle ADF] {11.1.1.x] 14-APR-2010 [http://andrejusb.blogspot.com/2010/04/implementing-custom-generic-plsql.html [[image:info.png]]] |- | <span id="JPU016"/>[[#JPU016|JPU016]] | [http://adf-samples.googlecode.com/files/FileDownloadSample.zip Customizing the execution of <af:fileDownloadActionListener> to validate user input] {11.1.1.2] 20-JAN-2010 [http://jobinesh.blogspot.in/2010/01/customizing-execution-of-to-validate.html [[image:info.png]]] |- | <span id="SMU159"/>[[#SMU159|SMU159]] | [http://java.net/projects/smuenchadf/sources/samples/content/AttributeLevelViewAccessorValidation.zip Using ViewAccessor to Perform Attribute-Level Validation] {11.1.1.2] 11-JAN-2010 |- |||This example illustrates two techniques to perform an attribute-level validation based on a view-accessor with a bind variable that needs to be bound to the value that is attempting to be set. For an entity-level validation, you can use a view accessor based list validator for this purpose. However, for the attribute-level use case - since you cannot refer to the newValue expression in the view accessor bind variable default Groovy expression - you need to either use a groovy expression validator, a Java method validator, or a custom validation rule. This workspace provides examples of the first and the last of these three options. The Java method validation alternative is left as an exercise to the reader. The Emp EO has two view accessors: CheckDivisibilityBy3 based on view object definition test.ValidationViewObject, configured to have the VarModulo value set to 3, and CheckDivisibilityBy7 based on the same view object, configured to have the VarModulo value set to 7 The attribute-level Groovy validator on the Sal attribute sets the value of the VarValue bind variable on the view accessor, then executes the query. It returns value if the view accessor's first() function returns a non-null result (i.e. at least one row was found). The example also illustrates a more generic approach that doesn't rely on Groovy. I created a new, reusable validation rule called AttrLevelViewAccessorValidator. I've used an instance of it on the Comm attribute, declaratively configuring the validation rule beans two properties: attrNameToBindNewValueTo = "VarValue" and viewAccessorName = "CheckDivisibilityBy7". Run the AM in the tester, and verify that you must enter a Sal value that is divisible by 3 and a Comm value that is divisible by 7. Of course, the example view object would normally be a more interesting query with one or more bind variables going against a table other than DUAL, but this simple query hopefully will get the basic idea across. If the value being validated were the key attribute of the target view object, you could have used the "Key Exists" validator based on a view accessor instead. This approach is valid when the query you need to validate needs to lookup something that is not the key attribute in the target VO used for validation. |- | <span id="ABA035"/>[[#ABA035|ABA035]] | [http://jdevsamples.googlecode.com/files/ConditionalMandatory.zip Conditionally Required Fields in Oracle ADF Faces Rich Client] {11.1.1.x] 30-DEC-2009 [http://andrejusb.blogspot.com/2009/12/conditionally-required-fields-in-oracle.html [[image:info.png]]] |- | <span id="SMU155"/>[[#SMU155|SMU155]] | [http://java.net/projects/smuenchadf/sources/samples/content/OnlyAddNewRowToTableOnceValid.zip Avoid Adding a New Row to a Table Until Its Valid] {11.1.1.2] 26-DEC-2009 |- |||This example illustrates an approach to prevent a newly-created row from getting automatically added to a view object's rowset (shown in a table) until it passes all validation rules. Typically a newly-created row will be added to a rowset for any view object based on the same entity object. This example contains a framework extension class for entity objects NotifyChangeOnValidatedEntityImpl and a framework extension class for view objects OnlyAddNewRowIfValidViewObjectImpl. The entity framework extension class overrides the validateEntity() framework method to send an attribute change notification after the entity object successfully passes validation. The view object framework extension class exposes getter and setter methods for a boolean property named onlyAddNewRowIfValid and the overridden rowQualifies() method ensures that a new row does not qualify for inclusion in the view object's rowsets unless it is valid. The AppModuleImpl class overrides the prepareSession() method to set the property on the DeptView1 view object instance. To run the demo, run the view1.jspx page. Click (Create) to create a new row. A data entry form appears at the top of the page. To cause a validation error to occur, leave the fields blank, or try entering a Dname value of upper-case X and a Loc value of upper-case Y. Notice that until the row validates, it's not added into the table. |- | <span id="LJE020"/>[[#LJE020|LJE020]] | [http://technology.amis.nl/blog/wp-content/uploads/ConditionallyRequiredFields.zip Implementing conditionally required input fields – by playing client side hide and seek] {11.1.1.x] 17-DEC-2009 [http://technology.amis.nl/2009/12/17/adf-11g-implementing-conditionally-required-input-fields-by-playing-client-side-hide-and-seek [[image:info.png]]] |- | <span id="ABA031"/>[[#ABA031|ABA031]] | [http://jdevsamples.googlecode.com/files/IsUpdateableByDate.zip Overriding IsAttributeUpdateable Method for Conditional Rendering] {11.1.1.x] 06-DEC-2009 [http://andrejusb.blogspot.com/2009/12/overriding-isattributeupdateable-method.html [[image:info.png]]] |- | <span id="SMU153"/>[[#SMU153|SMU153]] | [http://java.net/projects/smuenchadf/sources/samples/content/ValidateOnlyOnePrimaryEmailForMessage.zip Validating Exactly One Detail Row of a Given Type] {11.1.1.1] 04-NOV-2009 Custom schema |- |||<nowiki>This example illustrates two techniques for validating that a parent entity contains exactly one composed child entity of a given type. Start by running the CreateTables.sql script to create the EMAIL_MESSAGE and EMAIL_MESSAGE_RECIPIENTS tables. The example is a simple "Create an Email" application that allows you to create a new email message and add one or more recipients. Each recipient is of a particular RecipientType (P=Primary, C=CC, B=BCC). The rule being enforced is that there must be exactly one recipient of type "Primary". The validation is performed by an entity-level Script Expression validator on the parent Email entity object. This validator uses Groovy code to work with a view accessor named ValidateOnePrimary which is of type EmailRecipientsView and has the design-time-applied view criteria named PrimaryRecipient (criteria mode "Both") applied to it. This view criteria filters based on the MessageId and the RecipientType='P'. The view accessor is configured to pass the value of the current Email entity's Id attribute as the value of the view criteria's VarMessageId bind variable. Notice that the script validator allows multiple error messages to be defined. The validator's Groovy script executes the view accessor's query, raises one error using adf.error.raise(MESSAGE_KEY) if there are no rows returned and another error if more than one row is returned. If the email and its recipients validate successfully, then they are saved to the tables, but note that no real email is sent anywhere. The default expression for the EmailRecipient.RecipientType attribute uses an alternative approach to the view accessor in order to conditionally assign the default recipient type for a newly created EmailRecipient entity. The default expression is Email.Recipients.count("RecipientType == 'P' ? 1 : null") == 0 ? 'P' : 'C' which accesses the parent email message using the reverse association accessor named Email then accesses its rowset of recipients by references that email entity's Recipients association accessor attribute. Since the value of that expression is a RowSet we can use one of the built-in rowset, in-memory aggregation functions to calculate the count of the child EmailRecipient entity instances which have a RecipientType equal to P. The count() rowset aggregate function evaluates its String argument as a Groovy expression in the context of each row in the rowset over which it iterates. If the expression evaluates to null, then the count does not include that row. If the expression evaluates to non-null, then that row is counted. Finally, it uses a ternary expression so that if the count of EmailRecipient instances having RecipientType equals to P is zero, then it returns the default value of P, otherwise it returns the default value of C to represent a recipient being copied on the mail. The Email entity object includes the MessageText attribute of type ClobDomain, and both the Email.SenderEmail and EmailRecipient.RecipientEmailAddress attributes use a custom domain type EmailAddress which validates the format of an email address. The NewMailMessage.jsff page fragment uses the special <f:converter converterId="oracle.genericDomain"/> component to enable JSF to work properly with these three domain-valued attributes. The MailServer application module defines the custom method createNewMailAndPrimaryRecipient() which creates a new email message and the first email recipient row. The method is exposed on the client interface so that the default method call activity of the create-new-email bounded task flow can invoke it declaratively to prepare the service layer for the creation of a new email. The CustomViewObjectImpl class implement a generic feature to conditionally have rows in a view object's default rowset be inserted at the end. For view objects using this framework extension class as their base class, the feature "kicks in" if the VO has the "InsertRowsAtEnd" custom property set to some non-null value like "true". The EmailRecipientsView in the example uses this framework extension class as its base class and has this custom property set. To run the example, run the TestPage.jspx. You'll need to login as either user userone or usertwo, both of whose password is welcome1. Click on the button to create an "email" and then click (Send) to test the validation. </nowiki> |- | <span id="ABA022"/>[[#ABA022|ABA022]] | [http://jdevsamples.googlecode.com/files/BusinessGroups.zip Business Logic Groups in Oracle ADF 11g] {11.1.1.x] 03-NOV-2009 [http://andrejusb.blogspot.com/2009/11/business-logic-groups-in-oracle-adf-11g.html [[image:info.png]]] |- | <span id="LJE008"/>[[#LJE008|LJE008]] | [http://technology.amis.nl/blog/wp-content/uploads/InputFileValidation.zip Validation of Uploaded Files with the inputFile component] {11.1.1.x] 14-SEP-2009 [http://technology.amis.nl/2009/09/14/adf-11g-validation-of-uploaded-files-with-the-inputfile-component [[image:info.png]]] |- | <span id="JPU004"/>[[#JPU004|JPU004]] | [http://jobinesh.blogspot.in/2009/08/how-to-skip-validation.html How to Skip Validation?] {11.1.1.1] 22-AUG-2009 [http://jobinesh.blogspot.in/2009/08/how-to-skip-validation.html [[image:info.png]]] |- | <span id="ACC008"/>[[#ACC008|ACC008]] | [http://www.oracle.com/technetwork/developer-tools/adf/learnmore/08-captcha-168491.zip How-to use Captcha with ADF Faces and Oracle ADF] {11.1.1.x] 17-JUL-2009 [http://www.oracle.com/technetwork/developer-tools/adf/learnmore/08-captcha-169127.pdf [[image:info.png]]] |- | <span id="ACC010"/>[[#ACC010|ACC010]] | [http://www.oracle.com/technetwork/developer-tools/adf/learnmore/10-charcounter-168492.zip How-to create a character input counter for text fields] {11.1.1.x] 15-SEP-2008 [http://www.oracle.com/technetwork/developer-tools/adf/learnmore/10-char-input-counter-169133.pdf [[image:info.png]]] |}
 
 
Close
loading
Please Confirm
Close