> List of tutorials for developing a Fat-Client in Java

Index – Advanced Java-Fat-Client development

Code for Class JS_ProjAssist_Project_BOC

* For this document and all references (links) please obey the hints and regulations concerning copyright, disclaimer and trademarks.

  • The owner of this web-site (www.javascout.biz) is not responsible for the content of web-sites linked within this document or other documents of www.javascout.biz.

  • If this document or other documents of this web-site (www.javascout.biz) infringes your rights or you think that rights of others (third parties) are infringed, please inform the author.
    An e-mail can be sent by clicking onto the 'hungry mailbox' in the upper right corner.

Last revision of this document:
2006-09-15

This is document contains the code for Class JS_ProjAssist_Project_BOC.
For easy 'cut and paste' ;-)

package js_projassist.boc;

import javax.swing.*;


import js_base.frame.*;

import js_projassist.bo.*;
import js_projassist.bos.*;

/**
 
*
 * @author
kurt@javascout.biz
 * @date 2006-06-22
 *
 * @description
 *  Client-Side derivation of the Business Object for the 'Project'.
 *
 *  This class has the following functions:
 *  * Method to get values from GUI-elements
.
 *  * Method to set values to GUI-elements.
 *  * Method to store new or changed values of the Business Object;
 *    The decision, if the 'store' means INSERT of a new Object
 *    or an already existing Object has to be UPDATEd, is made
 *    at the Server-Side derivation of the Business Object.
 *  * Methods to read (SELECT) a Object.
 *    These methods are only implemented for search criteria that can
 *    deliver only one database-record.
 *    N.B.: for reading with search-criteria that may deliver a set of objects,
 *          a own class is implemented.
 *
 *  Within this class the selection is made, if the application is running with the database

 *  on the same machine (Stand-Alone) or
 *  it is a 'client-server' application and the data is held on a Java-Application-Server (JAS)
 *  and has to be retrieved using the EJB (Enterprise Java Bean) mechanism.
 *
 *  Not yet implemented is a 'mobile'-version of the application.
 *  There, data is held locally on the same machine (e.g. a notebook)
 *  and synchronized as soon as the local machine has a connection to the JAS.
 *  This requieres a balance between performance and up-to-dateness.
 *  Therefore a general scheme can not be implemented; for each Business Object
 *  a unique decision is needed how the synchronization has to be done.

 
*
 * @change-log
 * when         who               why
 * --------------------------------------------------------
 *
 */

public class JS_ProjAssist_Project_BOC extends JS_ProjAssist_Project_BO {
/*
 * Task-Frame that constructed this Client-Side BO.
 * There, the handles are defined to access the database (if Stand-Alone-Version)
 * or the JAS (if Client-Server-Version). */
    
JSBS_TaskFrame frmTask = null;
/*
 * CONSTRUCTOR
 * --------------------
 * Takes the task that constructed this class as a parameter and stores it
 * in the above defined variable. */
    public JS_ProjAssist_Project_BOC(JSBS_TaskFrame parmfrmTask) {
      frmTask = parmfrmTask;
    }

/*
 * METHODS
 * ---------------------- */
/*
 * Method to take the values from the GUI (Graphic-User-Interface) Elements
 * and transfer it to the variables of the Business Object. */
    public void getFromGUI(JTextField parmProjectCode,
                           JTextField parmLanguageCode,
                           JTextField parmTargetDirectory) {
      if (parmProjectCode != null) {
        ProjectCode = JSBS_GUIServices.getTextFromJTextField(parmProjectCode);
      }

      if (parmLanguageCode != null) {
        LanguageCode = JSBS_GUIServices.getTextFromJTextField(parmLanguageCode);
      }

      if (parmTargetDirectory != null) {
        TargetDirectory = JSBS_GUIServices.getTextFromJTextField(parmTargetDirectory);
      }

    }

/*
 * -----------
 * Method to transfer the values of this Business Object to the GUI (Graphic-User-Interface) Elements. */
    public void setToGUI(JTextField parmProjectCode,
                         JTextField parmLanguageCode,
                         JTextField parmTargetDirectory) {
/* To be implemented using not yet written formatting methods (K.G. 2206-07-28) */
    }

/*
 * --------------------
 * Method to store the new entered or changed values of this Business Objject.
 * The decision if an INSERT or UPDATE is needed is made in the BO(Server-Side) derivation. */
    public void store() {
      switch (frmTask.frmCC.RunVersion) {
/* Decide what version the application runs. */
      case JSBS_StartFrame.CONST_StandAlone:
/* Database is running on the local machine; construct the 'Server-Side' BO directly.
 * Pass all necessary connection-structures and this 'Client-Side' BO. */
        
JS_ProjAssist_Project_BOS bosJS_ProjAssist_Project_BOS =
          new JS_ProjAssist_Project_BOS(frmTask.structMinParm,
                               frmTask.frmCC.structJSBS_DB_ConnectionManager,
                               this);

/* Call the method to perform the database-operation(s). */
        bosJS_ProjAssist_Project_BOS.store();

/* Transfer the values as they include the Status and
 * changes of Common Attributes (performed by the BOS) */
        getJS_ProjAssist_Project_BO(bosJS_ProjAssist_Project_BOS);
      break;
      case JSBS_StartFrame.CONST_FatClient:
      break;
      }
    }

}