Posts

كيفية التعرف عل حالة السجل Record Status

السلام عليكم كان موجود فى الفورم  system variable   اسمه  :system. record _status و كان ممكن تستخدمة للتعرف على حالة السجل   new – modified    و اكيد التعرف على حالة السجل هيفيدك كتير فى ال  adf   كمان ممكن تعمل حاجة ذى دى لكن مش بالبساطة الموجودة فى الفورمز و ذلك لان الدنيا فى ال  adf   مفصولة عن بعضها مش كلها فى  layer   واحد ذى الفورم فى المثال التالي هنعرف ازاى نعمل  method   ترجعلك حالة السجل و ازاى نستخدمها فى الصفحة 1-      In the model project , go to the view object and click on java tab and generate the following java classes ·          View object class “ViewImpl” ·          View Row class “View row impl” كما بالشكل بالشكل المرفق رقم 1 لاحظ انا عملت generate  لل view row class  لان الكلاس دى هى اللى بتمثلي السجل اللى ا...

Debugging ADF Apllication

Image
How to Enable ADF Business Components Debug Diagnostics open the Run/Debug/Profile page in the Project Properties dialog for your data model project. Click  Edit  to edit the chosen run configuration, and add following string to the  Java Options  field in the page. -Djbo.debugoutput=console Example: Diagnostic Output of Business Component Browser : [355] Oracle SQLBuilder: Registered driver: oracle.jdbc.OracleDriver [356] Creating a new pool resource [357] **** DBTransactionImpl establishNewConnection [358] Successfully logged in [359] JDBCDriverVersion: 11.1.0.7.0-Production [360] DatabaseProductName: Oracle [361] DBTransactionImpl initTransaction [362] Replacing: null with: StoreServiceAM_AddressesPageDef [363] Replacing: null with: StoreServiceAM_MostPopularProductsByCategoriesPageDef ... [537] Orders ViewRowSetImpl.execute caused params to be "un"changed [538] Column count: 41 [539] ViewObject: Orders Created new QUERY statement [540] Orders>#q...

DISABLE Browser Caching

Browser caching of page content has negative security implications when your application runs on shared terminals (like the public library). You can turn it off with this simple phase listener. Well, maybe. As some of the comments indicate, browsers are finicky, and of course, we never trust the browser, anyway, so using this technique is certainly not a security guarantee of any kind. import javax.faces.context.FacesContext; import javax.faces.event.PhaseEvent; import javax.faces.event.PhaseId; import javax.faces.event.PhaseListener; import javax.servlet.http.HttpServletResponse; public class CacheControlPhaseListener implements PhaseListener {      public PhaseId getPhaseId()      {          return PhaseId.RENDER_RESPONSE;      }      public void afterPhase(PhaseEvent event)      {   ...

Sample IO Files Methods

How to delete file:             private void deleteOldFiles() {                 String path = JSFUtils.getContextPath();                 File userDirectory = new File(path + "\\tempDoc\\" +     ADFContext.getCurrent().getSessionScope().get("UserName"));                 if (userDirectory.exists()) {                     try {                         FileUtils.deleteDirectory(userDirectory);                     } catch (IOException e) {                         e.printStackTrace();                     }               ...

Upload data from excel + Oracle from

First, add a button to your canvas and write this code:when button pressed Declare   vfilename varchar2(500);   in_file   Client_Text_IO.File_Type;   linebuf   VARCHAR2(1800);    i number := 0; BEGIN     vfilename := client_get_file_name('c:/temp/', File_Filter=>'Comma Dialimeted Files (*.csv)|*.csv|');      in_file := client_Text_IO.Fopen(vfilename, 'r');       GO_BLOCK('DATA');      FIRST_RECORD;     LOOP     Client_Text_IO.Get_Line(in_file, linebuf);      p_output_line(linebuf);     Client_Text_IO.New_Line;      Next_record;      i:=i+1;   END LOOP;     FIRST_RECORD; EXCEPTION   WHEN no_data_found THEN     Client_Text_IO.Put_Line('Closing the file...');     Client_Text_IO.Fclose(in_file); END; --------------------------- ...

How to get Conection Using JNDI

    public Connection getJdbcUrl() {         Connection connection = null;         try {             InitialContext context = new InitialContext();             DataSource dataSource = (DataSource) context.lookup("jdbc/pmsDS");             connection = dataSource.getConnection();         } catch (NamingException e) {             e.printStackTrace();         } catch (SQLException e) {             e.printStackTrace();         }         return connection;     }

Logout From ADF application

Image
I implemented this method in the Action of the logout button public String logout{         FacesContext fctx = FacesContext.getCurrentInstance();         ExternalContext ectx = fctx.getExternalContext();         HttpSession session = (HttpSession) ectx.getSession(false);         session.invalidate();         HttpServletRequest request = (HttpServletRequest)ectx.getRequest();         HttpServletResponse response = (HttpServletResponse) ectx.getResponse();         ServletAuthentication.logout(request,response,false);         try{                ectx.redirect("http://iaigc.net");              }              catch(Exception e){                e.printStackTrace();   ...