Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions

:
#)AddNewMcoDistHandler. Copyright © 2012 tourapp.com. All rights reserved. GPL3 Open Source Software License.
  
  package com.tourapp.tour.acctrec.screen.mco.dist;
  
  import java.util.*;
  
AddNewMcoDistHandler - Add new Mco distribution record.
 
 {
    
Default constructor.
 
     public AddNewMcoDistHandler()
     {
         super();
     }
    
AddNewMcoDistHandler Method.
 
     public AddNewMcoDistHandler(Record record)
     {
         this();
         this.init(record);
     }
    
Initialize class fields.
 
     public void init(Record record)
     {
         super.init(record);
     }
    
Called when a change is the record status is about to happen/has happened.

Parameters:
field If this file change is due to a field, this is the field.
iChangeType The type of change that occurred.
bDisplayOption If true, display any changes.
Returns:
an error code. ADD_TYPE - Before a write. UPDATE_TYPE - Before an update. DELETE_TYPE - Before a delete. AFTER_UPDATE_TYPE - After a write or update. LOCK_TYPE - Before a lock. SELECT_TYPE - After a select. DESELECT_TYPE - After a deselect. MOVE_NEXT_TYPE - After a move. AFTER_REQUERY_TYPE - Record opened. SELECT_EOF_TYPE - EOF Hit.
 
     public int doRecordChange(FieldInfo fieldint iChangeTypeboolean bDisplayOption)
     {
         int iErrorCode = super.doRecordChange(fieldiChangeTypebDisplayOption);
         if (iErrorCode != .)
             return iErrorCode;
         if (!this.getOwner().getTableNames(false).equalsIgnoreCase(.))
             return .;   // If this is being overidden, don't do rest of code.
         switch (iChangeType)
         {
             case .:
                 BaseField fldBookingID = this.getOwner().getField(.);
                 if (!fldBookingID.isNull())
                 {
                     Object bookmark = this.getOwner().getLastModified(.);
                     if (bookmark != null)
                     {
                         try {
                             if ( == null)
                             {
                                 RecordOwner recordOwner = this.getOwner().findRecordOwner();
                                  = new McoBatchDist(recordOwner);
                                 if (recordOwner != null)
                                     recordOwner.removeRecord();
                             }
                             .addNew();
                             .getField(.).setData(bookmark);
                             .getField(.).moveFieldToThis(fldBookingID);
                             .getField(.).moveFieldToThis(this.getOwner().getField(.));
                             .add();
                         } catch (DBException ex)    {
                            ex.printStackTrace();
                        }
                    }
                }
            break;
        }
        return iErrorCode;
    }
New to GrepCode? Check out our FAQ X