Monday, 12 December 2011

Dynamic VOs in AM

    //Dynamic VOs in AM
   
    public Boolean checkIfTravelerRecord(Number number)
    {
        OADBTransactionImpl oadbtransactionimpl = (OADBTransactionImpl)getOADBTransaction();
        String s1 = "select count(1) as counter from PA_RATE_OVERHEADS where trvlr_flag='Y' and metro_group_id= :1 ";
        oracle.jbo.ViewObject vo = findViewObject("tempTravelerVO");
        if (vo !=null)
         {
          vo.remove();
         }
        oracle.jbo.ViewObject viewobject = createViewObjectFromQueryStmt("tempTravelerVO", s1);
        viewobject.setWhereClauseParam(0, number);
        Object obj = null;
        viewobject.executeQuery();
        if(viewobject.hasNext())
        {
            oracle.jbo.Row row = viewobject.next();
            if(row.getAttribute(0) != null)
              {  //s = row.getAttribute(0).toString();
                try
                {
                int s2 = Integer.parseInt(row.getAttribute(0).toString());
                if( s2 >0 )
                {
                  return Boolean.TRUE;
                }
                }
                catch (Exception E2)
                {}
              }
        }
        viewobject.remove();
        return Boolean.FALSE;
    }

No comments:

Post a Comment