org.apache.empire.struts2.actionsupport
Class RecordActionSupport

java.lang.Object
  extended by org.apache.empire.struts2.actionsupport.FormActionSupport
      extended by org.apache.empire.struts2.actionsupport.RecordFormActionSupport
          extended by org.apache.empire.struts2.actionsupport.RecordActionSupport

public class RecordActionSupport
extends RecordFormActionSupport

RecordActionSupport

This class provides functions for form data processing for a given Table or View (DBRowSet).
The record object provided with the constructor will be used to obtain further context specific metadata such as field options (getFieldOptions) and field accessibility (isFieldReadOnly).
The record object should initially be invalid and not attached to any Table or View (DBRowSet).

Author:
Rainer

Nested Class Summary
static class RecordActionSupport.SessionPersistance
          Deprecated. 
 
Field Summary
protected static org.slf4j.Logger log
           
protected  DBRecord record
           
protected  DBRowSet rowset
           
 
Fields inherited from class org.apache.empire.struts2.actionsupport.RecordFormActionSupport
persistence
 
Fields inherited from class org.apache.empire.struts2.actionsupport.FormActionSupport
action, propertyName
 
Constructor Summary
RecordActionSupport(ActionBase action, DBRowSet rowset, DBRecord record, RecordActionSupport.SessionPersistance persistence)
          Deprecated. 
RecordActionSupport(ActionBase action, DBRowSet rowset, DBRecord record, RecordActionSupport.SessionPersistance persistence, String propertyName)
          Deprecated. 
RecordActionSupport(ActionBase action, DBRowSet rowset, DBRecord record, SessionPersistence persistence)
           
RecordActionSupport(ActionBase action, DBRowSet rowset, DBRecord record, SessionPersistence persistence, String propertyName)
           
 
Method Summary
 void closeRecord()
          Closes the record and releases any allocated session objects
 boolean createRecord()
          creates a new record.
Depending on the persistence setting the record key or the record data will be stored on the session.
 boolean deleteRecord()
          deletes the current record database.
 boolean deleteRecord(Object[] recKey, boolean newRec)
          deletes the record identified by the supplied key from the database.
 DBRecord detachRecord()
           
 Object[] findAnyConflictRecord()
           
 List<DBIndex> findChangedIndexes()
           
 RecordActionSupport.SessionPersistance getPersistance()
          Deprecated. 
 DBRecord getRecord()
           
 DBRowSet getRowset()
           
 void initReferenceColumns()
          sets all required foreign keys for this record.
The foreign key values must be supplied with the request.
 boolean isLoadBeforeDelete()
           
 boolean loadFormData()
          loads the data from the form into the current record object
 boolean loadFormData(Object[] recKey, boolean insert)
          This function load all form date from the request into the record for each record column the following steps are taken 1.
 boolean loadRecord()
          loads the record either from the supplied item key on the request or from the session.
 void loadRecord(Object[] recKey)
          loads the record identified by the supplied key from the database
 void reloadRecord()
          reloads the current record from the session.
If persistence is set to Key then the key is obtained from the session and the record is reloaded from the database.
 boolean saveChanges()
          Updates the record by calling onUpdateRecord and updates the currentKey The update will not be committed, hence the caller must commit or rollback the operation
 void setLoadBeforeDelete(boolean loadBeforeDelete)
           
protected  boolean setRecordFieldValue(int i, Object value, boolean verify)
          overridable: sets the value of single field
protected  void updateRecord(Connection conn)
          overridable: onUpdateRecord
 
Methods inherited from class org.apache.empire.struts2.actionsupport.RecordFormActionSupport
compareKey, getActionParamKey, getActionParamNewFlag, getPersistence, getRecordFromSession, getRecordKeyString, getRequestFieldName, hasActionKey, isNewRecord, persistOnSession, removeFromSession, setUpdateFields
 
Methods inherited from class org.apache.empire.struts2.actionsupport.FormActionSupport
addFieldError, getActionParam, getRecordPropertyName, isEnableFieldErrors, setEnableFieldErrors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.slf4j.Logger log

rowset

protected DBRowSet rowset

record

protected DBRecord record
Constructor Detail

RecordActionSupport

public RecordActionSupport(ActionBase action,
                           DBRowSet rowset,
                           DBRecord record,
                           SessionPersistence persistence,
                           String propertyName)

RecordActionSupport

public RecordActionSupport(ActionBase action,
                           DBRowSet rowset,
                           DBRecord record,
                           SessionPersistence persistence)

RecordActionSupport

@Deprecated
public RecordActionSupport(ActionBase action,
                                      DBRowSet rowset,
                                      DBRecord record,
                                      RecordActionSupport.SessionPersistance persistence,
                                      String propertyName)
Deprecated. 


RecordActionSupport

@Deprecated
public RecordActionSupport(ActionBase action,
                                      DBRowSet rowset,
                                      DBRecord record,
                                      RecordActionSupport.SessionPersistance persistence)
Deprecated. 

Method Detail

getRecord

public DBRecord getRecord()
Specified by:
getRecord in class RecordFormActionSupport

getRowset

public DBRowSet getRowset()

isLoadBeforeDelete

public boolean isLoadBeforeDelete()

setLoadBeforeDelete

public void setLoadBeforeDelete(boolean loadBeforeDelete)

getPersistance

@Deprecated
public RecordActionSupport.SessionPersistance getPersistance()
Deprecated. 


createRecord

public boolean createRecord()
creates a new record.
Depending on the persistence setting the record key or the record data will be stored on the session.

Returns:
true if the record was successfully created or false otherwise

initReferenceColumns

public void initReferenceColumns()
sets all required foreign keys for this record.
The foreign key values must be supplied with the request.


loadRecord

public void loadRecord(Object[] recKey)
loads the record identified by the supplied key from the database


loadRecord

public boolean loadRecord()
loads the record either from the supplied item key on the request or from the session.

Returns:
true if the record has been successfully reloaded or false otherwise

reloadRecord

public void reloadRecord()
reloads the current record from the session.
If persistence is set to Key then the key is obtained from the session and the record is reloaded from the database.


deleteRecord

public boolean deleteRecord(Object[] recKey,
                            boolean newRec)
deletes the record identified by the supplied key from the database.

Parameters:
recKey - the record key
newRec - flag indicating whether it is a new unsaved record.
Returns:
true if the record has been successfully deleted

deleteRecord

public final boolean deleteRecord()
deletes the current record database.

Returns:
true if the record has been successfully deleted

loadFormData

public boolean loadFormData(Object[] recKey,
                            boolean insert)
This function load all form date from the request into the record for each record column the following steps are taken 1. Detects the control type of the column 2. Let's the corresponding InputControl read, parse and validate the value from the request 3. If a field error occurred the error is stored on the action using action.setFieldError(...) 4. Stores either the parsed or - in case of an error - the request value in the record. This procedure does not stop if a field error occurs. Use Action.hasActionError() or Action.getFieldErrors() to determine whether a field error has occurred.

Returns:
true if the record could be loaded and the form data has been filled in

loadFormData

public boolean loadFormData()
Description copied from class: RecordFormActionSupport
loads the data from the form into the current record object

Overrides:
loadFormData in class RecordFormActionSupport
Returns:
true if all fields supplied with the request have been successfully set on the record

saveChanges

public boolean saveChanges()
Updates the record by calling onUpdateRecord and updates the currentKey The update will not be committed, hence the caller must commit or rollback the operation

Returns:
true if the update was successful otherwise false

closeRecord

public void closeRecord()
Closes the record and releases any allocated session objects


detachRecord

public DBRecord detachRecord()

findChangedIndexes

public final List<DBIndex> findChangedIndexes()

findAnyConflictRecord

public final Object[] findAnyConflictRecord()

updateRecord

protected void updateRecord(Connection conn)
overridable: onUpdateRecord


setRecordFieldValue

protected boolean setRecordFieldValue(int i,
                                      Object value,
                                      boolean verify)
Description copied from class: RecordFormActionSupport
overridable: sets the value of single field

Overrides:
setRecordFieldValue in class RecordFormActionSupport


Copyright © 2008–2014 Apache Software Foundation. All rights reserved.