com.sage.accpac.sm
Class View

java.lang.Object
  extended by com.sage.accpac.sm.view.AbstractGettableByField
      extended by com.sage.accpac.sm.view.AbstractSettableByField
          extended by com.sage.accpac.sm.View
All Implemented Interfaces:
HasDispose, Composable, GettableByField, HasFieldAttributesByField, HasOrder, HasRevisionListSupport, HasViewAttributes, HasViewFieldByField, IView, Modifiable, Navigable, OrderedModifiable, OrderedReadable, Processable, Readable, SettableByField

@NotThreadSafe
public class View
extends AbstractSettableByField
implements IView

Represents a ASage 300 ERPview
An object of this class can be created directly by an application (possibly by sub-classing) or it can be obtained from the Program or DBLink object's openIView method.
Objects of this class are not thread-safe.
The caller must call the dispose method when finished with the object so that all its resources can be released. The caller must not call any other method on the object after calling dispose.
After calling a method the application should check that the program's error stack is still clear. The view may very well add information to the call stack and still return success. If a method returns a SuccessLevel then if the level is Success there should not be any errors on the program's stack (but that is not guaranteed). If it returns Warning then the caller should check the program's error stack.

Thread safety
Thread-unsafe. Actually I am unsure. It is probably safe to access an instance from two threads but it will almost certainly lead to confusion and not be what is wanted. You should apply suitable synchronization to prevent confusion.

Nested Class Summary
static class View.FilterOrigin
          Specifies the origin from where a filter should be applied
static class View.OpenDirectives
          Indicates the method to be used when opening a view.
static class View.OpenModes
          The set of values that can be used to make the mode passed when opening a view.
static class View.Protocol
          Protocols
static class View.RecordGenerateMode
          The mode passed to recordGenerate(com.sage.accpac.sm.View.RecordGenerateMode)
static class View.ReferentialIntegrity
          Indicates the referential integrity setting of a view
static class View.RotoType
          Indicates the type of a view.
static class View.Security
          Security values which indicate the functionality the user is permitted to access on the view.
static class View.SystemAccess
          Indicates the current access mode of a view
 
Constructor Summary
View(DBLink parent, java.lang.String rid)
          Constructs an instance of the View class for the given roto id on the given link.
View(DBLink parent, java.lang.String rid, int modes, int prefetch, int directives)
          Constructs an instance of the View class for the given roto id on the given link using the given mode, directives and prefetch.
View(Program program, java.lang.String rid)
          Simple constructor based on Program
View(Program program, java.lang.String rid, int modes, int prefetch, int directives)
          constructor based on Program
 
Method Summary
 void addNotificationListener(NotificationListener l)
          Add the given listener.
 void autocompose(View... views)
          composes the supplied list of views against this view, passing them in the correct order.
 java.lang.Object[] blkGet(int... fieldIDs)
          obtain the values of several fields
 void blkPut(boolean verify, int[] fieldIDs, java.lang.Object[] values)
          Change the field values of multiple fields
 void browse(java.lang.String filter, boolean isAscending)
          Starts a query and establishes the direction for subsequent calls that fetch records from the view.
 void cancel()
          cancels any unsaved changes in the view's revision list.
 void compose(View... views)
          composes the supplied list of views against this view.
protected static com.sage.accpac.sm.DBLinkImpl confirmNativeDBLink(DBLink parent)
          check that the DBLink has enough package-private capability
protected  ViewField createField(int index, int id, java.lang.String name)
          create an instance of the ViewField class corresponding to the zero-based index of the field within this view.
static void createTables(DBLink link, java.lang.String rid)
          Create the view's tables on the link's current database connection
static void createTables(Program program, java.lang.String rid)
          Create the view's tables on the program's current database connections
 void delete()
          Deletes the current record from the database
 void dispose()
          Closes the view and releases all resources used by the object.
protected  void doBrowse(java.lang.String filter, boolean ascending)
          Thread-safe
static void dropTables(DBLink link, java.lang.String rid)
          Drop the view's tables on the link's current database connection
static void dropTables(Program program, java.lang.String rid)
          Drop the view's tables on the program's current database connections
 void filterDelete(java.lang.String filter)
          Deletes the set of records that satisfy the supplied filter, including all children.
 void filterSelect(java.lang.String filter, boolean isAscending, int order, View.FilterOrigin origin)
          Starts a query and establishes the direction for subsequent calls that fetch records from the view.
protected  void finalize()
          overrides the finalize method of object so that the dispose gets called if it hasn't already
 int getCombinedFilterCount(java.lang.String transientFilter)
          Gets the number of records in the view that match a filter in combination with the current persistent browse filter
 java.util.List<java.lang.String> getComposites()
          Gets a list of IDs of the views that the caller may explicitly compose.
 java.lang.String[] getDefiningKeyValues()
          gets the values of the fields that define the current record relative to its header (if any).
 java.lang.String[] getDefiningKeyValues(int key)
          Deprecated. 
 java.lang.String getDescription()
          Description of the view
 boolean getDirty()
          Indicates whether the current record is dirty.
 java.lang.String getETag()
          gets the Edit Tag for the record.
 boolean getExists()
          Indicates whether the current (primary?) key field values identify an existing record in the database
 IViewField getField(int field)
          gets the given field
 IViewField getField(java.lang.String field)
          gets the given field
 HasFieldAttributes getFieldAttributes(int field)
          gets the attributes of the given field
 HasFieldAttributes getFieldAttributes(java.lang.String field)
          gets the attributes of the given field
 ViewFields getFields()
          Deprecated. 
 int getFilterCount(java.lang.String filter)
          Gets the number of records in the view that match the filter
protected  Gettable getGettableByIndex(int field)
          the subclass provides the requested Gettable for the given field
protected  Gettable getGettableByName(java.lang.String field)
          the subclass provides the requested Gettable for the given field
 boolean getHasUnpostedRevisions()
          Gets a value indicating whether there are unposted revisions in the view
 boolean getInstanceNoncascading()
          Gets the Noncascading mode flag
 boolean getInstanceNonheritable()
          Gets whether the composite views implicitly opened by the current view inherit the additional parameters of the current view when it was opened.
 int getInstancePrefetch()
          Gets the number of records fetched at a time, if the view was opened read-only
 int getInstanceProtocol()
          Gets the view's protocol
 boolean getInstanceRawPut()
          Reserved
 boolean getInstanceReadOnly()
          gets whether the view is opened in read-only mode
 boolean getInstanceUnrevisioned()
          Gets whether revisioning is suppressed.
 boolean getInstanceUnValidated()
          Gets whether validation is suppressed.
 IProgram getIProgram()
          Gets the IProgram under which this View object is.
 IViewKey getKey(int index)
          Gets the key with the given zero-based index.
 ViewKeys getKeys()
          Deprecated. 
 int getOrder()
          gets the current order or key number.
 DBLink getParent()
          gets the DBLink that this is a view under
 Program getProgram()
          Gets the Program under which this View object is.
 View.ReferentialIntegrity getReferentialIntegrity()
          gets the current referential integrity flag of the view
 View.Security getSecuritySettings()
          Deprecated. 
protected  Settable getSettableByIndex(int field)
          the subclass provides the requested Settable for the given field
protected  Settable getSettableByName(java.lang.String field)
          the subclass provides the requested Settable for the given field
 View.SystemAccess getSystemAccess()
          gets the current system access mode of the view
 java.util.Date getTemplateDate()
          gets the template date of the view
 java.lang.String getTemplateVersion()
          gets the template version of the view
 View.RotoType getType()
          Gets the view type
 IViewFields getViewFields()
          Gets the collection of fields for the view.
 java.lang.String getViewID()
          Gets the view ID of the current view.
 IViewKeys getViewKeys()
          Gets the collection of keys
 ViewSecurity getViewSecurity()
          Gets the ViewSecurity settings that list the access rights the current user has on the view.
 boolean goBottom()
          goes to the bottom (last) record defined by the current query.
 boolean goNext()
          goes to the next record defined by the current query.
 boolean goPrev()
          goes to the previous record defined by the current query.
 boolean goTop()
          goes to the top (first) record defined by the current query.
 boolean goToQueryRecord(java.lang.String filter)
          Goes to the record identified by the combination of the given filter and the current persistent filter.
 void insert()
          Inserts the current record into the database.
 boolean isNotification()
          Returns true if and only if the view instance was created with the ability to handle notifications.
 void post()
          Posts unsaved changes to the view.
 void post(ThreadEventListener listener)
          Performs view-specific posting on a separate thread
 int process()
          Performs view-specific processing
 int process(MeterEventListener meterListener)
          Performs view-specific processing which may raise a meter, providing a listener for the meter.
 void process(ThreadEventListener listener)
          Performs view-specific processing on a separate thread
 void putDefiningKeyValues(java.lang.String[] values)
          sets the values of the fields that define the current record relative to its header (if any).
 void putDefiningKeyValues(java.lang.String[] values, int key)
          Deprecated. 
 boolean read()
          Locates and retrieves the record in the view according to the key field values of the current record.
 boolean read(boolean lockRecord)
          Locates and retrieves the record in the view according to the key field values of the current record.
 void recordClear()
          Blanks, zeroes or defaults the fields in the view.
 void recordGenerate(View.RecordGenerateMode mode)
          Generate a unique nonexistent key, and blanks, zeroes or defaults the remaining fields in the view.
 void refreshSchema()
          informs the view that the caller has reason to suppose that the schema has changed, in particular the list of fields and keys.
 void removeNotificationListener(NotificationListener l)
          Remove the given listener.
 void revisionCancel(int level)
          Rolls back any pending changes to the specified revision level
 boolean revisionExists(int level)
          Checks whether the current record exists within the specified revision level
 void revisionPost(int level)
          Commits any changes to the specified revision level
 boolean revisionUnposted(int level)
          Checks whether the specified revision level has unposted changes
 void setETag(java.lang.String tag)
          Sets the Edit Tag for the record.
 void setOrder(int order)
          Sets the current selected key on the view.
 void setReferentialIntegrity(View.ReferentialIntegrity value)
          sets the current referential integrity flag of the view
 void setSystemAccess(View.SystemAccess value)
          sets the current system access mode of the view
static void shutdownExecutor()
          shut down the executor being used for calls in separate threads
 boolean supportsETag()
          Returns whether the view supports ETags.
 void tableEmpty()
          Deletes all records in the database table in the fastest way possible
 java.lang.String toString()
           
 void unlock()
          Unlocks a record previously locked by Modifiable.read(boolean)
 void update()
          Updates the current record into the database.
 boolean verify()
          Validates the field values of the current record
 
Methods inherited from class com.sage.accpac.sm.view.AbstractSettableByField
set, set, set, set, setBigDecimal, setBigDecimal, setBigDecimal, setBigDecimal, setBoolean, setBoolean, setBoolean, setBoolean, setBytes, setBytes, setBytes, setBytes, setDate, setDate, setDate, setDate, setDouble, setDouble, setDouble, setDouble, setInt, setInt, setInt, setInt, setShort, setShort, setShort, setShort, setString, setString, setString, setString, setTime, setTime, setTime, setTime
 
Methods inherited from class com.sage.accpac.sm.view.AbstractGettableByField
get, get, getBigDecimal, getBigDecimal, getBoolean, getBoolean, getBytes, getBytes, getDate, getDate, getDouble, getDouble, getInt, getInt, getShort, getShort, getString, getString, getTime, getTime
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sage.accpac.sm.view.SettableByField
set, set, set, set, setBigDecimal, setBigDecimal, setBigDecimal, setBigDecimal, setBoolean, setBoolean, setBoolean, setBoolean, setBytes, setBytes, setBytes, setBytes, setDate, setDate, setDate, setDate, setDouble, setDouble, setDouble, setDouble, setInt, setInt, setInt, setInt, setShort, setShort, setShort, setShort, setString, setString, setString, setString, setTime, setTime, setTime, setTime
 
Methods inherited from interface com.sage.accpac.sm.view.GettableByField
get, get, getBigDecimal, getBigDecimal, getBoolean, getBoolean, getBytes, getBytes, getDate, getDate, getDouble, getDouble, getInt, getInt, getShort, getShort, getString, getString, getTime, getTime
 

Constructor Detail

View

public View(DBLink parent,
            java.lang.String rid,
            int modes,
            int prefetch,
            int directives)
Constructs an instance of the View class for the given roto id on the given link using the given mode, directives and prefetch.

Call dispose() when finished with the instance.

Parameters:
parent - the DBLink on which the view is opened.
rid - the rotoid (e.g. BK0001) of the view. This must be six characters long once trimmed.
modes - an integer value containing a set of flags that control behaviour. See View.OpenModes.
prefetch - the number of records to pre-fetch when the view is opened (0 to 63)
directives - specifies how the view should be used. See View.OpenDirectives.
If the view does not identify itself as a 4.2A or later template (either it identifies itself as earlier or it does not support the xxxVersionTemplate entry) then the InstanceOpen directive will be assumed.
See Also:
dispose(), View.OpenDirectives, View.OpenModes

View

public View(Program program,
            java.lang.String rid,
            int modes,
            int prefetch,
            int directives)
constructor based on Program

Call dispose() when finished with the instance.

Parameters:
program - the Program on which the view is opened.
rid - the roto id (e.g. BK0001) of the view. This must be six characters long once trimmed.
modes - an integer value containing a set of flags that control behaviour. See View.OpenModes.
prefetch - the number of records to pre-fetch when the view is opened (0 to 63)
directives - specifies how the view should be used. See View.OpenDirectives.
See Also:
dispose(), View.OpenDirectives, View.OpenModes

View

public View(DBLink parent,
            java.lang.String rid)
Constructs an instance of the View class for the given roto id on the given link.

The instance is constructed with default modes, directives and prefetch count.

Call dispose() when finished with the instance.

Parameters:
parent - the link on which the view is opened.
rid - the roto id (e.g. BK0001) of the view. This must be six characters long once trimmed.
See Also:
dispose()

View

public View(Program program,
            java.lang.String rid)
Simple constructor based on Program

Call dispose() when finished with the instance.

Parameters:
program - the Program on which the view is opened.
rid - the roto id (e.g. BK0001) of the view. This must be six characters long once trimmed.
See Also:
dispose()
Method Detail

confirmNativeDBLink

protected static com.sage.accpac.sm.DBLinkImpl confirmNativeDBLink(DBLink parent)
check that the DBLink has enough package-private capability

Parameters:
parent - a {DBLink} that we need to check is actually a native one
Returns:
the link, cast to the native form

dispose

public void dispose()
Closes the view and releases all resources used by the object. Do not call any methods after calling this.

Specified by:
dispose in interface HasDispose
Specified by:
dispose in interface IView

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addNotificationListener

public void addNotificationListener(NotificationListener l)
Add the given listener.
For the listener to receive events the view must also have been created with the InstanceNotify directive specified (e.g. using the extended constructor).

Specified by:
addNotificationListener in interface IView
Parameters:
l - the NotificationListener to be added
See Also:
IView.removeNotificationListener(com.sage.accpac.sm.NotificationListener), NotificationListener

autocompose

public void autocompose(View... views)
composes the supplied list of views against this view, passing them in the correct order.
This will handle many compositions. However if the composite list contains duplicates use the normal compose function.

Examples

OE0520 has a compositeNames list of OE0500, OE0680, OE0180, OE0740, OE0526 and OE0522.

Using an array:
 View oe0520 = s.getView("OE0520");
 Views[] va = new Views[2];
 va[0] = s.getView("OE0180");
 va[2] = s.getView("OE0500");
 oe0520.compose(va);
 
Using var-args:
 View oe0520 = s.getView("OE0520");
 View oe0500 = s.getView("OE0500");
 View oe0180 = s.getView("OE0180");
 oe0520.compose(oe180, oe0500);
 

Specified by:
autocompose in interface Composable
Parameters:
views - var-args list of or array of Views to be composed against this view. It is permissible to provide more views than are needed; the excess will be ignored.
See Also:
getComposites

blkGet

public java.lang.Object[] blkGet(int... fieldIDs)
obtain the values of several fields

This behaves equivalently to multiple calls to AbstractGettableByField.get(int).

Specified by:
blkGet in interface GettableByField
Parameters:
fieldIDs - variable length list or array of the ids of the fields to be fetched
Returns:
an array of objects containing the field values in the order specified
Throws:
java.lang.NullPointerException - if dispose() has been called on the view.
See Also:
get by numeric id, get by field name

blkPut

public void blkPut(boolean verify,
                   int[] fieldIDs,
                   java.lang.Object[] values)
Change the field values of multiple fields

Specified by:
blkPut in interface SettableByField
Parameters:
verify - specifies whether the values should be verified at this stage
fieldIDs - the ids of the fields
values - the values. There must be at least as many as there are fieldIDs
Throws:
java.lang.NullPointerException - if dispose() has been called on the view.
java.lang.IllegalArgumentException - if there are fewer values than fieldIDs
UncheckedCharacterCodingException - if there is a conversion error. It will be a InvalidCharacterException if one of the inputs is a string that contains a character that cannot map to the character set of the session. It will be a DamagedStringException if one of the inputs is a string that is actually not a valid string (for example contains a trailing character without its leading character)
StringTooLongException - if one of the objects passed in will not fit in the number of bytes specified by its type
See Also:
AbstractSettableByField.set(int, Object)

browse

public void browse(java.lang.String filter,
                   boolean isAscending)
Starts a query and establishes the direction for subsequent calls that fetch records from the view.

Specified by:
browse in interface HasOrder
Parameters:
filter - string containing the filter expression that restricts the records that will be retrieved.
isAscending - boolean value indicating whether subsequent records will be fetched in ascending or descending order. Calling browse does not change the ordering of records being fetched from the view. To control the ordering, use the setOrder() method to select a key.
See Also:
HasOrder.filterSelect(java.lang.String, boolean, int, com.sage.accpac.sm.View.FilterOrigin), Navigable.goNext(), Navigable.goPrev()

cancel

public void cancel()
cancels any unsaved changes in the view's revision list.

Specified by:
cancel in interface HasRevisionListSupport

compose

public void compose(View... views)
composes the supplied list of views against this view.

Examples

OE0520 has a compositeNames list of OE0500, OE0680, OE0180, OE0740, OE0526 and OE0522.

Using an array:
 View oe0520 = s.getView("OE0520");
 Views[] va = new Views[3];
 va[0] = s.getView("OE0500");
 va[1] = null;
 va[2] = s.getView("OE0180");
 oe0520.compose(va);
 
Using var-args:
 View oe0520 = s.getView("OE0520");
 View oe0500 = s.getView("OE0500");
 View oe0180 = s.getView("OE0180");
 oe0520.compose(oe0500, null, oe0180);
 
But Not:

DO NOT DO THIS; the second argument should be a third argument.

 View oe0520 = s.getView("OE0520");
 View oe0500 = s.getView("OE0500");
 View oe0180 = s.getView("OE0180");
 oe0520.compose(oe0500, oe0180);
 

Specified by:
compose in interface Composable
Parameters:
views - var-args list of or array of Views to be composed against this view. The views in the list/array must be in the same order as the list returned by Composable.getComposites() with null references used as place-holders for those views that are not being provided. The trailing null references may be excluded. It is permissible to provide more views than are needed; the excess will be ignored.
See Also:
getComposites

createTables

public static void createTables(DBLink link,
                                java.lang.String rid)
Create the view's tables on the link's current database connection

Parameters:
link - the link on which to create the tables
rid - the Roto Id of the view whose tables are to be created

createTables

public static void createTables(Program program,
                                java.lang.String rid)
Create the view's tables on the program's current database connections

Parameters:
program - the program on which to create the tables. If the view is not one of the standard Sage 300 ERP views and is a view on the system database then use the link-based overload.
rid - the Roto Id of the view whose tables are to be created

delete

public void delete()
Deletes the current record from the database

Specified by:
delete in interface Modifiable

dropTables

public static void dropTables(DBLink link,
                              java.lang.String rid)
Drop the view's tables on the link's current database connection

Parameters:
link - the link on which to drop the tables
rid - the Roto Id of the view whose tables are to be dropped

dropTables

public static void dropTables(Program program,
                              java.lang.String rid)
Drop the view's tables on the program's current database connections

Parameters:
program - the program on which to drop the tables. If the view is not one of the standard Sage 300 ERP views and is a view on the system database then use the link-based overload.
rid - the Roto Id of the view whose tables are to be dropped

filterDelete

public void filterDelete(java.lang.String filter)
Deletes the set of records that satisfy the supplied filter, including all children.

Specified by:
filterDelete in interface IView
Parameters:
filter - the filter to be applied. If the filter is a null reference or an empty or blank string this corresponds to matching all records.

filterSelect

public void filterSelect(java.lang.String filter,
                         boolean isAscending,
                         int order,
                         View.FilterOrigin origin)
Starts a query and establishes the direction for subsequent calls that fetch records from the view.

Specified by:
filterSelect in interface HasOrder
Parameters:
filter - A filter that restricts the records that will be retrieved.
isAscending - Indicates whether subsequent records will be fetched in ascending or descending order.
order - The key index to select on the view.
origin - The range of records the filter would affect.

getComposites

public java.util.List<java.lang.String> getComposites()
Gets a list of IDs of the views that the caller may explicitly compose.

Specified by:
getComposites in interface Composable
Returns:
an unmodifiable list of strings containing the roto IDs of the views that may be composed, in the order that they must be passed to compose.
See Also:
Composable.compose(View...)

getDescription

public java.lang.String getDescription()
Description of the view

Specified by:
getDescription in interface HasViewAttributes
Returns:
the description of the view

getDirty

public boolean getDirty()
Indicates whether the current record is dirty. A record is dirty if any of the field values were modified by the application since the record was last saved.

Specified by:
getDirty in interface IView
Returns:
true if, and only if, the current record is dirty

supportsETag

public boolean supportsETag()
Returns whether the view supports ETags. If the view does not support ETags then calling IView.getETag() or IView.setETag(java.lang.String) will result in an UnsupportedOperationException.

Specified by:
supportsETag in interface IView
Returns:
true if the view supports the ETag calls and false otherwise.
See Also:
IView.getETag(), IView.setETag(String)

getETag

public java.lang.String getETag()
gets the Edit Tag for the record.

Specified by:
getETag in interface IView
Returns:
the Edit Tag as a String
See Also:
IView.supportsETag(), IView.setETag(String)

getExists

public boolean getExists()
Indicates whether the current (primary?) key field values identify an existing record in the database

Specified by:
getExists in interface Readable
Returns:
true if, and only if, the record identified by the (primary?) key exists in the database

getFields

@Deprecated
public ViewFields getFields()
Deprecated. 

Gets the ViewFields of fields for the view.

Note that the returned reference will become obsolete if refreshSchema() is called.

Deprecated - use getViewFields()

Returns:
the ViewFields of the view
See Also:
refreshSchema()

getFilterCount

public int getFilterCount(java.lang.String filter)
Gets the number of records in the view that match the filter

Specified by:
getFilterCount in interface IView
Parameters:
filter - the filter that defines which records to count
Returns:
the number of records that match the filter

getCombinedFilterCount

public int getCombinedFilterCount(java.lang.String transientFilter)
Gets the number of records in the view that match a filter in combination with the current persistent browse filter

Specified by:
getCombinedFilterCount in interface IView
Parameters:
transientFilter - the filter to be combined with the persistent browse filter
Returns:
the number or records which matches the combined filter

goToQueryRecord

public boolean goToQueryRecord(java.lang.String filter)
Goes to the record identified by the combination of the given filter and the current persistent filter. The view is left in a state where a subsequent fetch would retrieve the next record with respect to the persistent filter alone.

Specified by:
goToQueryRecord in interface IView
Parameters:
filter - the filter to apply (in combination with the persistent filter}
Returns:
true if a record was found.

getHasUnpostedRevisions

public boolean getHasUnpostedRevisions()
Gets a value indicating whether there are unposted revisions in the view

Specified by:
getHasUnpostedRevisions in interface HasRevisionListSupport
Returns:
true if, and only if, the view has unposted revisions

getDefiningKeyValues

public java.lang.String[] getDefiningKeyValues()
gets the values of the fields that define the current record relative to its header (if any).

A view can have a header view, a view that is a parent to this view. For example the header of a batch entry is the batch itself, and the header of an order detail line is the order itself. When putting data to the key fields there is generally no need to put to those fields that are references to the parent and indeed for some protocols doing so might result in an error.

Normally the header/detail relationship is defined by the primary key (key 0) but on some occasions there may be more than one header/detail relationship.

Specified by:
getDefiningKeyValues in interface IView
Returns:
an array of Strings containing the fields in the order they appear in the key of the current order.
See Also:
IView.putDefiningKeyValues(java.lang.String[]), HasOrder.getOrder()

getDefiningKeyValues

@Deprecated
public java.lang.String[] getDefiningKeyValues(int key)
Deprecated. 

gets the values of the fields that define the current record relative to its header (if any).

This method is deprecated. Use the IView.getDefiningKeyValues() form instead. If you truly have a use case for getting the defining values for some order other than the current order please contact us and we can consider undoing the deprecation of this method.

A view can have a header view, a view that is a parent to this view. For example the header of a batch entry is the batch itself, and the header of an order detail line is the order itself. When putting data to the key fields there is generally no need to put to those fields that are references to the parent and indeed for some protocols doing so might result in an error.

Normally the header/detail relationship is defined by the primary key (key 0) but on some occasions there may be more than one header/detail relationship.

Specified by:
getDefiningKeyValues in interface IView
Parameters:
key - the key that defines the header/detail relationship.
Returns:
an array of Strings containing the fields in the order they appear in the key.
See Also:
IView.putDefiningKeyValues(java.lang.String[])

putDefiningKeyValues

public void putDefiningKeyValues(java.lang.String[] values)
sets the values of the fields that define the current record relative to its header (if any).

A view can have a header view, a view that is a parent to this view. For example the header of a batch entry is the batch itself, and the header of an order detail line is the order itself. When putting data to the key fields there is generally no need to put to those fields that are references to the parent and indeed for some protocols doing so might result in an error.

Normally the header/detail relationship is defined by the primary key (key 0) but on some occasions there may be more than one header/detail relationship. This method assumes that the current order (see HasOrder.getOrder() is the one that defines the relationship.

Specified by:
putDefiningKeyValues in interface IView
Parameters:
values - an array of Strings containing all the fields in the order they appear in the key. The leading ones may be checked against the header but will not be set. The defining ones will be set.
See Also:
IView.getDefiningKeyValues()

putDefiningKeyValues

@Deprecated
public void putDefiningKeyValues(java.lang.String[] values,
                                            int key)
Deprecated. 

sets the values of the fields that define the current record relative to its header (if any).

This method is deprecated. Use the IView.putDefiningKeyValues(String[]) form instead. If you truly have a use case for getting the defining values for some order other than the current order please contact us and we can consider undoing the deprecation of this method.

A view can have a header view, a view that is a parent to this view. For example the header of a batch entry is the batch itself, and the header of an order detail line is the order itself. When putting data to the key fields there is generally no need to put to those fields that are references to the parent and indeed for some protocols doing so might result in an error.

Normally the header/detail relationship is defined by the primary key (key 0) but on some occasions there may be more than one header/detail relationship.

Specified by:
putDefiningKeyValues in interface IView
Parameters:
values - an array of Strings containing all the fields in the order they appear in the key. The leading ones may be checked against the header but will not be set. The defining ones will be set.
key - the key that defines the header/detail relationship.
See Also:
IView.getDefiningKeyValues()

getInstanceNoncascading

public boolean getInstanceNoncascading()
Gets the Noncascading mode flag

Specified by:
getInstanceNoncascading in interface HasViewAttributes
Returns:
true if this view instance is non-cascading

getInstanceNonheritable

public boolean getInstanceNonheritable()
Gets whether the composite views implicitly opened by the current view inherit the additional parameters of the current view when it was opened.

Specified by:
getInstanceNonheritable in interface HasViewAttributes
Returns:
true if this view instance is non-inheritable

getInstancePrefetch

public int getInstancePrefetch()
Gets the number of records fetched at a time, if the view was opened read-only

Specified by:
getInstancePrefetch in interface HasViewAttributes
Returns:
the number of records fetched at a time

getInstanceProtocol

public int getInstanceProtocol()
Gets the view's protocol

Specified by:
getInstanceProtocol in interface HasViewAttributes
Returns:
the view's protocol which will be a combination of the values of View.Protocol.

getInstanceRawPut

public boolean getInstanceRawPut()
Reserved

Specified by:
getInstanceRawPut in interface HasViewAttributes
Returns:
whether RawPut is enabled for this instance

getInstanceReadOnly

public boolean getInstanceReadOnly()
gets whether the view is opened in read-only mode

Specified by:
getInstanceReadOnly in interface HasViewAttributes
Returns:
whether this instance is read-only

getInstanceUnrevisioned

public boolean getInstanceUnrevisioned()
Gets whether revisioning is suppressed.

Specified by:
getInstanceUnrevisioned in interface HasRevisionListSupport
Returns:
whether revisioning is suppressed for this instance

getInstanceUnValidated

public boolean getInstanceUnValidated()
Gets whether validation is suppressed.

Specified by:
getInstanceUnValidated in interface HasViewAttributes
Returns:
whether validation is suppressed for this instance

getKeys

@Deprecated
public ViewKeys getKeys()
Deprecated. 

get the collection of keys

Note that the returned reference will become obsolete if refreshSchema() is called.

This method is deprecated; use getViewKeys() or getKey(int)

Returns:
the list of keys.
See Also:
refreshSchema(), getViewKeys()

getOrder

public int getOrder()
gets the current order or key number.

Specified by:
getOrder in interface HasOrder
Returns:
the current order or key number
See Also:
HasOrder.setOrder(int), HasOrder.filterSelect(java.lang.String, boolean, int, com.sage.accpac.sm.View.FilterOrigin)

getParent

public DBLink getParent()
gets the DBLink that this is a view under

Specified by:
getParent in interface IView
Returns:
the DBLink that this is a view under

getProgram

public Program getProgram()
Gets the Program under which this View object is.

Specified by:
getProgram in interface IView
Returns:
the Program under which this View is found.

getReferentialIntegrity

public View.ReferentialIntegrity getReferentialIntegrity()
gets the current referential integrity flag of the view

Specified by:
getReferentialIntegrity in interface HasViewAttributes
Returns:
the View.ReferentialIntegrity for the view

getSecuritySettings

@Deprecated
public View.Security getSecuritySettings()
Deprecated. 

Gets the View.Security settings that list the access rights the current user has on the view.

This version is deprecated; use getViewSecurity() instead.

Returns:
a View.Security value that is the combination of the access rights the user has on the view.
Throws:
java.lang.NullPointerException - if dispose() has been called on the view.

getViewSecurity

public ViewSecurity getViewSecurity()
Gets the ViewSecurity settings that list the access rights the current user has on the view.

Specified by:
getViewSecurity in interface HasViewAttributes
Returns:
a ViewSecurity value that is the combination of the access rights the user has on the view.

getSystemAccess

public View.SystemAccess getSystemAccess()
gets the current system access mode of the view

Specified by:
getSystemAccess in interface HasViewAttributes
Returns:
the current system access mode of the view

getTemplateDate

public java.util.Date getTemplateDate()
gets the template date of the view

Specified by:
getTemplateDate in interface HasViewAttributes
Returns:
the template date of the view

getTemplateVersion

public java.lang.String getTemplateVersion()
gets the template version of the view

Specified by:
getTemplateVersion in interface HasViewAttributes
Returns:
the template version of the view

getType

public View.RotoType getType()
Gets the view type

Specified by:
getType in interface HasViewAttributes
Returns:
the View.RotoType of this view

getViewFields

public IViewFields getViewFields()
Gets the collection of fields for the view.

Note that the returned reference will become obsolete if IView.refreshSchema() is called.

Specified by:
getViewFields in interface IView
Returns:
the IViewFields of the view
See Also:
IView.refreshSchema()

getViewID

public java.lang.String getViewID()
Gets the view ID of the current view.

Specified by:
getViewID in interface HasViewAttributes
Returns:
the view ID of the current view.

getIProgram

public IProgram getIProgram()
Gets the IProgram under which this View object is.

Specified by:
getIProgram in interface IView
Returns:
the IProgram under which this View is found.

getKey

public IViewKey getKey(int index)
Gets the key with the given zero-based index.

Specified by:
getKey in interface HasOrder
Parameters:
index - the zero-based index of the key desired.
Returns:
the key with the given zero-based index
See Also:
to get the collection if you need it to check the count or to search for a specific key

getViewKeys

public IViewKeys getViewKeys()
Gets the collection of keys

Specified by:
getViewKeys in interface HasOrder
Returns:
the collection of keys

goBottom

public boolean goBottom()
goes to the bottom (last) record defined by the current query. The bottom record is the one with no next record. See Navigable.goNext() for more details.

Specified by:
goBottom in interface Navigable
Returns:
true if a record was found.

goNext

public boolean goNext()
goes to the next record defined by the current query.

The caller will have set up the query by a call to HasOrder.filterSelect(java.lang.String, boolean, int, com.sage.accpac.sm.View.FilterOrigin) or HasOrder.browse(java.lang.String, boolean), possibly combined with HasOrder.setOrder(int). The query expresses:

Immediately following either a call to browse or filterSelect(...FilterOrigin.FromOrigin) a call to this method will return the record identified by the current primary key fields if it exists, or the next record if there is no record identified by the current primary key fields, or will return false if there is no such next record.

Immediately, in this context, means before any call to one of the navigation methods:

If there has been a call to one of the navigation methods then a call to this method will return the next record from the one identified by the current primary key values.

Note that this means although it is legal to jump around the set of records the results will not be quite what was expected unless a call to browse occurs at each jump, to signal that the current record is to be included.

For example:

 view.filterSelect(myFilter, true, 0, FilterOrigin.FromStart);
 while (view.goNext())
 {
    processRecord(view);
 }
 

Specified by:
goNext in interface Navigable
Returns:
true if a record was found.

goPrev

public boolean goPrev()
goes to the previous record defined by the current query. See Navigable.goNext() for more details.

Specified by:
goPrev in interface Navigable
Returns:
true if a record was found.

goTop

public boolean goTop()
goes to the top (first) record defined by the current query. The top record is the one with no previous record. See Navigable.goNext() for more details.

Specified by:
goTop in interface Navigable
Returns:
true if a record was found.

insert

public void insert()
Inserts the current record into the database.

Specified by:
insert in interface Modifiable

isNotification

public boolean isNotification()
Returns true if and only if the view instance was created with the ability to handle notifications. This typically happens if the View.OpenDirectives.InstanceNotify directive was specified in the constructor.

Specified by:
isNotification in interface HasViewAttributes
Returns:
whether or not notification is enabled on the view

post

public void post()
Posts unsaved changes to the view. This method is used primarily on header views where the call has a cascading effect that causes its detail views to update the unposted revisions.

Specified by:
post in interface IView

post

public void post(ThreadEventListener listener)
Performs view-specific posting on a separate thread

Specified by:
post in interface IView
Parameters:
listener - the ThreadEventListener to which thread events are to be sent

process

public int process()
Performs view-specific processing

Specified by:
process in interface Processable
Returns:
the view return code. Unlike most methods this one does not throw an exception on view errors.
Throws:
java.lang.NullPointerException - if dispose() has been called on the view.

process

public void process(ThreadEventListener listener)
Performs view-specific processing on a separate thread

Specified by:
process in interface Processable
Parameters:
listener - the ThreadEventListener to which thread events are to be sent

process

public int process(MeterEventListener meterListener)
Performs view-specific processing which may raise a meter, providing a listener for the meter.

Specified by:
process in interface Processable
Parameters:
meterListener - the MeterEventListener to which meter events will be sent
Returns:
the view return code. Unlike most methods this one does not throw an exception on view errors.

read

public boolean read()
Locates and retrieves the record in the view according to the key field values of the current record.

This is equivalent to Modifiable.read(boolean) with an argument of false.

If necessary call HasOrder.setOrder(int) on the same object to specify which key is to be used.

Specified by:
read in interface Readable
Returns:
whether the intended record exists in the view and is retrieved.

read

public boolean read(boolean lockRecord)
Locates and retrieves the record in the view according to the key field values of the current record.

This overloads Readable.read(), allowing specifying that the record should be locked.

Specified by:
read in interface Modifiable
Parameters:
lockRecord - boolean value indicating if the record should be locked after it is retrieved.
Returns:
whether the intended record exists in the view and is retrieved.
See Also:
Modifiable.unlock()

recordClear

public void recordClear()
Blanks, zeroes or defaults the fields in the view.

This appears to be the preferred method to set up for a forward navigation, rather than calling Navigable.goTop().

Specified by:
recordClear in interface Navigable

recordGenerate

public void recordGenerate(View.RecordGenerateMode mode)
Generate a unique nonexistent key, and blanks, zeroes or defaults the remaining fields in the view.

Specified by:
recordGenerate in interface Modifiable
Parameters:
mode - a View.RecordGenerateMode indicating how to generate the record

removeNotificationListener

public void removeNotificationListener(NotificationListener l)
Remove the given listener.

Specified by:
removeNotificationListener in interface IView
Parameters:
l - the listener to remove.
See Also:
IView.addNotificationListener(com.sage.accpac.sm.NotificationListener), NotificationListener

refreshSchema

public void refreshSchema()
informs the view that the caller has reason to suppose that the schema has changed, in particular the list of fields and keys.

The view will refresh its information. Any outstanding references to fields etc. are the concern of the caller.

Specified by:
refreshSchema in interface IView
See Also:
HasOrder.getViewKeys(), IView.getViewFields()

revisionCancel

public void revisionCancel(int level)
Rolls back any pending changes to the specified revision level

Specified by:
revisionCancel in interface HasRevisionListSupport
Parameters:
level - Revision level

revisionExists

public boolean revisionExists(int level)
Checks whether the current record exists within the specified revision level

Specified by:
revisionExists in interface HasRevisionListSupport
Parameters:
level - Revision level
Returns:
whether the current record exists within the specified revision level

revisionPost

public void revisionPost(int level)
Commits any changes to the specified revision level

Specified by:
revisionPost in interface HasRevisionListSupport
Parameters:
level - Revision level

revisionUnposted

public boolean revisionUnposted(int level)
Checks whether the specified revision level has unposted changes

Specified by:
revisionUnposted in interface HasRevisionListSupport
Parameters:
level - Revision level
Returns:
whether the specified revision level has unposted changes

setETag

public void setETag(java.lang.String tag)
Sets the Edit Tag for the record. This is a very unusual thing to do!

Typically the Edit Tag is a representation of the Audit Stamp of the record and so this operation attempts to set the Audit Stamp. Since it sets it to a value returned by IView.getETag() it is equivalent to setting the Edit Tag to a previous state. The normal behavior is that if the provided Edit Tag is the same as the record's current one nothing happens but if it is different then it is altered and any subsequent attempt to perform Modifiable.update() will fail, indicating a record conflict.

Note that setting the Edit Tag will not prevent a Modifiable.delete() operation if the Edit Tag is different.

A suggested alternative to setting the Edit Tag is to use IView.getETag() to get the current Edit tag of the record and only perform the Modifiable.update() or Modifiable.delete() if the Edit Tag is not as expected.

Specified by:
setETag in interface IView
Parameters:
tag - the Edit Tag. This should be a value returned by a previous call to IView.getETag(). The caller should not attempt to create Edit Tags for themselves.

setOrder

public void setOrder(int order)
Sets the current selected key on the view. Changing the selected key affects the order in which records are fetched from the view.

Specified by:
setOrder in interface HasOrder
Parameters:
order - the key to select
See Also:
HasOrder.getOrder(), HasOrder.filterSelect(java.lang.String, boolean, int, com.sage.accpac.sm.View.FilterOrigin)

setReferentialIntegrity

public void setReferentialIntegrity(View.ReferentialIntegrity value)
sets the current referential integrity flag of the view

Specified by:
setReferentialIntegrity in interface IView
Parameters:
value - the View.ReferentialIntegrity value to set

setSystemAccess

public void setSystemAccess(View.SystemAccess value)
sets the current system access mode of the view

Specified by:
setSystemAccess in interface IView
Parameters:
value - the View.SystemAccess to set

tableEmpty

public void tableEmpty()
Deletes all records in the database table in the fastest way possible

Specified by:
tableEmpty in interface IView

unlock

public void unlock()
Unlocks a record previously locked by Modifiable.read(boolean)

Specified by:
unlock in interface Modifiable

update

public void update()
Updates the current record into the database.

Specified by:
update in interface Modifiable

verify

public boolean verify()
Validates the field values of the current record

Specified by:
verify in interface Modifiable
Returns:
true if the record is valid and false if it is not valid. Note that even if the method returns true the caller should still check to see if there is any additional information on the program's error stack that should be displayed to the user.

createField

protected ViewField createField(int index,
                                int id,
                                java.lang.String name)
create an instance of the ViewField class corresponding to the zero-based index of the field within this view. This is called by the ViewFields class returned by getFields(). Override this method if you need to be able to create application-specific subclasses of the ViewField class.

Parameters:
index - the zero-based index of the field in the view's set of fields.
name - the name of the field
id - the id (or index)
Returns:
the newly created instance. Do not return null; throw an exception on failure.

shutdownExecutor

public static void shutdownExecutor()
shut down the executor being used for calls in separate threads


doBrowse

protected void doBrowse(java.lang.String filter,
                        boolean ascending)
Thread-safe

Performs the actual viewBrowse on the underlying Sage 300 ERP view.

No other methods within the View will invoke a viewBrowse on the underlying Sage 300 ERP view so this method can be overridden as a funnel to catch all cases where a viewBrowse would occur and perform the necessary customizations that the Sage 300 ERP view requires of an external caller.

Parameters:
filter - string containing the filter expression that restricts the records that will be retrieved.
ascending - boolean value indicating whether subsequent records will be fetched in ascending or descending order.
Throws:
UncheckedCharacterCodingException - if there is a conversion error (see StringEncoder.toA4wFormat).
java.lang.NullPointerException - if dispose() has been called on the view.

finalize

protected void finalize()
                 throws java.lang.Throwable
overrides the finalize method of object so that the dispose gets called if it hasn't already

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

getGettableByIndex

protected Gettable getGettableByIndex(int field)
the subclass provides the requested Gettable for the given field

Specified by:
getGettableByIndex in class AbstractGettableByField
Parameters:
field - the field index whose Gettable is desired
Returns:
a Gettable

getGettableByName

protected Gettable getGettableByName(java.lang.String field)
the subclass provides the requested Gettable for the given field

Specified by:
getGettableByName in class AbstractGettableByField
Parameters:
field - the field name whose Gettable is desired
Returns:
a Gettable

getSettableByIndex

protected Settable getSettableByIndex(int field)
the subclass provides the requested Settable for the given field

Specified by:
getSettableByIndex in class AbstractSettableByField
Parameters:
field - the field index whose Settable is desired
Returns:
a Settable

getSettableByName

protected Settable getSettableByName(java.lang.String field)
the subclass provides the requested Settable for the given field

Specified by:
getSettableByName in class AbstractSettableByField
Parameters:
field - the field name whose Settable is desired
Returns:
a Settable

getFieldAttributes

public HasFieldAttributes getFieldAttributes(java.lang.String field)
gets the attributes of the given field

Specified by:
getFieldAttributes in interface HasFieldAttributesByField
Parameters:
field - the field name of the field
Returns:
a HasFieldAttributes representing the field

getFieldAttributes

public HasFieldAttributes getFieldAttributes(int field)
gets the attributes of the given field

Specified by:
getFieldAttributes in interface HasFieldAttributesByField
Parameters:
field - the field index of the field
Returns:
a HasFieldAttributes representing the field

getField

public IViewField getField(java.lang.String field)
gets the given field

Specified by:
getField in interface HasViewFieldByField
Parameters:
field - the field name of the field
Returns:
an IViewField representing the field

getField

public IViewField getField(int field)
gets the given field

Specified by:
getField in interface HasViewFieldByField
Parameters:
field - the field index of the field
Returns:
an IViewField representing the field


Copyright © 2011 Sage Software, Inc. All rights reserved.