Wednesday, March 28, 2012

ADF client side validations with inbuilt validation tags


Validate maximum length;
<af:inputText id="id0" value="12A" label="Maximum length validator">
<af:validateLength maximum="5"/>
</af:inputText>
Validate minimum length;
<af:inputText id="id00" value="12A" label="Minimum length validator">
<af:validateLength minimum="3"/>
</af:inputText>
Validate length range;
<af:inputText id="id01" value="12A" label="Length Range Validator">
<af:validateLength minimum="1" maximum="5"/>
</af:inputText>
Validate long range;
<af:inputText id="id2" value="10" label="Long Range Validator">
<af:validateLongRange minimum="5" maximum="50"/>
</af:inputText>
Validate double range;
<af:inputText id="id3" value="8.6" label="Double Range Validator">
<af:validateDoubleRange minimum="4.1" maximum="8.9"/>
</af:inputText>
Validate regular expression;
<af:inputText id="id4" value="9999" label="Regular Expression validation">
<af:validateRegExp pattern="[9]*"/ >
</af:inputText>
Date validation with filter condition;
<af:inputDate id="id5" value="2011-05-21"
label="Select a date, but not a Friday">
<af:convertDateTime pattern="yyyy-MM-dd"/>
<af:validateDateRestriction invalidDaysOfWeek="Fri"/>
</af:inputDate>
Validate date range;
<af:inputDate id="mdf3ee" value="2011-11-25" label="Submission period">
<af:convertDateTime pattern="yyyy-MM-dd"/>
<!-- Supports ISO date format strings of the form "yyyy-MM-dd" -->
<af:validateDateTimeRange minimum="2011-11-16" maximum="2011-12-16"/>
</af:inputDate>

Saturday, January 21, 2012

Set and get object into/from session

/**
* Method for setting an object in session
* @param name
* @param value
* @return null
*/
public static void setSessionValue(String name, Object value) {
FacesContext context = FacesContext.getCurrentInstance();
HttpServletRequest request =
(HttpServletRequest)context.getExternalContext().getRequest();
HttpSession httpSession = request.getSession(false);
httpSession.setAttribute(name, value);
}
/**
* Method for getting an object from session
* @param null
* @return Object
*/
public static Object getSessionValue(String attName) {
FacesContext context = FacesContext.getCurrentInstance();
HttpServletRequest request =
(HttpServletRequest)context.getExternalContext().getRequest();
HttpSession httpSession = request.getSession(false);
return httpSession.getAttribute(attName);
}

Friday, January 20, 2012

Some more usefull methods in ViewObjectImpl

1.getFilteredRows(java.lang.String attrName, java.lang.Object attrValue)
          Returns all rows in this collection whose attribute value matches the value being passed in attrValue.

 2.getRow(Key key)
          Returns the first row matching a given key.

 3.setCurrentRow(Row row)
          Designates a given row as the current row.
 getCurrentRow()
          Returns the current row of the iterator.

for more info
ViewObjectImpl API

Sunday, January 8, 2012

jdevloper not taking the latest changes – what to do?

Sometime when you do the changes and run the application the latest changes are not updated while running the application.
The culprit is the system folder.
{user_home}\system11.1.1.4.37.57.75\o.j2ee\drs\
has the exploded war file which will have the classes that is old. deleting the classes from the exploded directory would definitely fix the issue.

Enable FastSwap in Weblogic deployment to load java classes at runtime without relaoding the classloader

 Fast Swap
Specifies whether FastSwap deployment is used to minimize redeployment since Java classes are redefined in place without reloading the ClassLoader. For more information, see "Using FastSwap Deployment to Minimize Redeployment" in Deploying Applications to Oracle WebLogic Server.

Enable Class Redefinition
Select to enable FastSwap.

Refresh Interval
FastSwap checks for changes in application classes when an incoming HTTP request is received. Subsequent HTTP requests arriving within the number of seconds specified here will not trigger a check for changes. The first HTTP request arriving after the number of seconds specified here have passed, will cause FastSwap to perform a class-change check again.

Redefinition Task Limit
Specifies the number of redefinition tasks that will be retained by the FastSwap system. If the number of tasks exceeds this limit, older tasks are automatically removed.


The following types of changes are supported with FastSwap:
  • Addition of static methods
  • Removal of static methods
  • Addition of instance methods
  • Removal of instance methods
  • Changes to static method bodies
  • Changes to instance method bodies
  • Addition of static fields
  • Removal of static fields
  • Addition of instance fields
  • Removal of instance fields