Showing posts with label Validation. Show all posts
Showing posts with label Validation. Show all posts

09 July, 2012

Add Validation at Runtime in ADF


An user request the below requirement.
He want to change validation condition in specific attribute at Entity Object at runtime.

For example there is a maximum of employee salary which can be changed at runtime, therefore the user doesn't want the maximum salary of employee to be fixed.

So I will create a new method for setting Validation Expression at runtime using Groovy.

   public void addExpressionValidator(AttributeDef attributeDef, String groovyExpression, String errorMessage) {  
     //create new ExpressionValidator  
     JboExpressionValidator jboExpressionValidator = new JboExpressionValidator(false, groovyExpression);  
   
     //Set an error message  
     jboExpressionValidator.setErrorMsgId(errorMessage);  
   
     //adding the validator to the attribute  
     ((AttributeDefImpl)attributeDef).addValidator(jboExpressionValidator);  
   
   }  

15 June, 2012

Insert only One Record in Table


Sometimes you have table in your system that has only one record like Configuration, Setup, Settings tables.
You want to prevent users from inserting more than one record in this table, To do this you can use the below INDEX .

CREATE UNIQUE INDEX ONE_ROW_INDEX
   ON TABLE_NAME (1);

If you try to insert more than one record in previous table you will get below exception
ORA-00001: unique constraint (SCHEMA.ONE_ROW_ALLOWED) violated

Thanks
Mahmoud A. El-Sayed

03 March, 2012

Plsql Exception Management - Part 1


Achieving ideal error management
You should take care of the following points
1-Define your requirements clearly
2-Understand PL/SQL error management features and make full use of what PL/SQL has to offer
3-When will errors be raised, when handled?
     Do you let errors go unhandled to the host, trap locally, or trap at the top-most level?
4-How should errors be raised and handled?
    Will users do whatever they want or will there be standard approaches that everyone will follow?
5-Useful to conceptualize errors into three categories: Deliberate, unfortunate, unexpected

PL/SQL error management features
1- Defining exceptions
2- Raising exceptions
3- Handing exceptions

We will explain every topic individually

06 August, 2011

Skip Validation in ADF


We can add validation at View , Model and business Services as wee need.
Sometimes we need to skip that validation and continue in executing the requested action.
Some developers in set immediate property to TRUE for UIcomponent but there is drawback of that property that it allows processing of UIcomponent to move to Apply Request Values phase of the life cycle.

We have another solution for skipping validation without moving up to  Apply Request Values phase of the life cycle as illustrated below.

ADF : Scope Variables

Oracle ADF uses many variables and each variable has a scope. There are five scopes in ADF (Application, Request, Session, View and PageFl...