org.sandev.basics.sandmessages
Class MessageDescription

java.lang.Object
  extended by org.sandev.basics.structs.MessageDescriptionStruct
      extended by org.sandev.basics.sandmessages.MessageDescription
All Implemented Interfaces:
SandInstanceMessage, SandMessage, SandStructMessage, Resolvable

public class MessageDescription
extends MessageDescriptionStruct
implements SandStructMessage, Resolvable

AUTOGENERATED FILE, DO NOT EDIT DIRECTLY.
source: org.sandev.basics.structs.MessageDescriptionStruct
generator: org.sandev.generator.MessageClassGenerator
time: Jul 31, 2008 4:34:15 PM


Field Summary
 
Fields inherited from class org.sandev.basics.structs.MessageDescriptionStruct
description, messageClass
 
Fields inherited from interface org.sandev.basics.structs.SandInstanceMessage
FIELDCHECK_EMPTYSTRINGPRINTVAL, FIELDCHECK_INVALIDVAL, FIELDCHECK_NOTAREF, FIELDCHECK_NOTINRANGE, FIELDCHECK_NULLARRAY, FIELDCHECK_STRINGOVER, FIELDCHECK_UNKNOWNVAL, FIELDFLAG_BINARY, FIELDFLAG_ENCRYPT, FIELDFLAG_INTERNAL, FIELDFLAG_NOECHO, FIELDFLAG_OBFUSCATE, FIELDFLAG_STRINGPERSIST, FIELDFLAG_SUMMARYEDIT, FIELDFLAG_UNIQUE, GENMOD_ACTION_APPEND, GENMOD_ACTION_INSERT, GENMOD_ACTION_REMOVE, GENMOD_ACTION_SET
 
Constructor Summary
MessageDescription()
          Default constructor calls init.
 
Method Summary
 void addDescription(SandAttrVal element)
          Appends a value to description
 void addDescription(SandAttrVal[] elements)
          Appends an array of values to description
 void clearDescription()
          Clears all values from description
 SandInstanceMessage cloneMessage()
          Calls cloneMessageDescription
 MessageDescription cloneMessageDescription()
          Make a deep copy of this MessageDescription.
 SandInstanceMessage convertToSuperstructClass()
          Return a new instance of the message associated with the superstruct of this instance.
 void copyDataFrom(MessageDescription other, boolean deepcopy)
          Copy all the data from the specified instance.
 void copyFieldValue(java.lang.String fieldName, SandInstanceMessage other)
          Copy the specified field from the given instance.
 java.lang.String debugDump(java.lang.String prefix)
          Dump this instance into a debug printable string.
 void defaultField(java.lang.String fieldname)
          Set the specified field to its default value.
 boolean descriptionContains(SandAttrVal val)
          Returns true if description contains the specified value.
 int descriptionIndexOf(SandAttrVal val)
          Return the index of the specified value in description, or -1 if not found.
 boolean fieldHasFlag(java.lang.String fieldname, int fieldflag)
          Return true if the named field declares the indicated flag, false otherwise.
 boolean fieldsValid()
          Validate the fields as specified in the SandInstanceMessage interface
 SandAttrVal[] fieldValidate(SandAttrVal[] checkFields)
          Validate the fields as specified in the SandInstanceMessage interface
 SandCollectionMessage find(SandQueryMessage sqm)
          Return a matching collection of all directly contained instances matching the given query.
 java.lang.Object generalAccessor(java.lang.String fieldspec)
          General field accessor method.
 SandAttrVal generalDereference(java.lang.String fieldspec)
          General reference field accessor method.
 void generalModifier(int action, java.lang.String field, int index, java.lang.Object val)
          General mutator method.
 java.lang.String[] getAllFields()
          Return an array of all fields for this class.
 int getBaseMemoryUse()
          Return the base memory use for this object.
 SandCollectionMessage getCollectionMessage()
          Returns null
 java.lang.String[] getContainedMessageFields()
          Return an array of all contained message fields.
 SandAttrVal[] getDescription()
          Accessor for description.
 SandAttrVal getDescription(int index)
          Returns the element at the specified index.
static SandAttrVal[] getDescriptionDefaultValue()
          Default value for description.
static SandAttrVal getDescriptionElementInvalidValue()
          Invalid value for descriptionelement.
 java.lang.String getDescriptionFieldPrintValue()
          Return the print name of the description field.
static boolean getDescriptionFlag(int fieldflag)
          Field flag accessor.
static SandAttrVal[] getDescriptionInvalidValue()
          Invalid value for description.
 java.lang.String getDescriptionMetatype()
          Return the metatype text for this field, or "" if no metatype was declared.
 java.lang.String getDescriptionPrintValue()
          Retrieve the current value of this field as a print String.
 java.lang.String getDescriptionRange()
          Return the range specification for this field
 java.lang.String getDescriptionValidityCheck()
          Return the empty string if the value of this field is valid according to the base SAND declarations.
 java.lang.String[] getDisplayFields()
          Return an array of the summary field names for this class.
 java.lang.String[] getDisplayFieldsPrint()
          Return an array of the summary field print names for this class.
 java.lang.String getDisplayID()
          Return the displayID for this message instance
 java.lang.String[] getDisplayValues()
          Return the values for the summary fields.
 java.lang.String[] getDisplayValues(IDLookup lookup, AuthUser user, java.lang.String defaultVal)
          Return the values for the summary fields, including dereference expressions.
 SandPersistMessage getInstance(java.lang.String classname, long id)
          If this instance directly contains the specified instance, then find it and return it.
 SandInstanceMessage getInstance(java.lang.String classname, java.lang.String fieldname, java.lang.String value)
          If this instance directly contains the specified instance, then find it and return it.
 java.lang.String getLayoutXML()
          Return the fieldlayout XML or null if not defined.
 java.lang.String getMessageClass()
          Accessor for messageClass
static java.lang.String getMessageClassDefaultValue()
          Default value for messageClass.
 java.lang.String getMessageClassFieldPrintValue()
          Return the print name of the messageClass field.
static boolean getMessageClassFlag(int fieldflag)
          Field flag accessor.
static java.lang.String getMessageClassInvalidValue()
          Invalid value for messageClass.
static int getMessageClassLengthMax()
          Maximum messageClass length is 80 characters
static int getMessageClassLengthNorm()
          Normal messageClass length is 60 characters
 java.lang.String getMessageClassMetatype()
          Return the metatype text for this field, or "" if no metatype was declared.
 java.lang.String getMessageClassPrintValue()
          Retrieve the current value of this field as a print String.
 java.lang.String getMessageClassRange()
          Return the range specification for this field
 java.lang.String getMessageClassValidityCheck()
          Return the empty string if the value of this field is valid according to the base SAND declarations.
 java.lang.String getPrintname()
          Return the printname of the class
 java.lang.String getPrintnameForField(java.lang.String fieldname)
          Given a fieldname, return its declared printname if declared.
 SandQueryMessage getQueryMessage()
          Returns null
 java.lang.String getShortName()
          Returns the unqualified name of this message.
 SandStructMessage getStructMessage()
          Returns a new MessageDescription instance
 SandUpdateMessage getUpdateMessage()
          Returns null
 java.lang.String getValueForFieldName(java.lang.String fieldname, IDLookup lookup, AuthUser user, java.lang.String defaultVal)
          Returns the print representation of the value of the specified field, or the given default value if innaccessible.
 void init()
          Initialize all fields to their default values
 void insertDescription(int index, SandAttrVal value)
          Insert the specified element at the specified index.
 boolean isEquivalent(SandMessage sm)
          Declared field equivalence check as specified by the SandMessage interface.
 java.lang.String[] referenceValidate(java.lang.String[] locations, java.lang.String prefix, IDLookup idlookup, NameLookup namelookup, AuthUser au)
          Validate the references as specified in the Resolvable interface.
 SandAttrVal removeDescription(int index)
          Remove the element at the specified index and return it.
 boolean removeDescriptionValue(SandAttrVal value)
          Removes the given element from description.
 void setDescription(int index, SandAttrVal value)
          Set the value at the index specified.
 void setDescription(java.lang.Object[] description)
          Generic mutator for description
 void setDescription(SandAttrVal[] description)
          Mutator for description
 void setMessageClass(java.lang.Object messageClass)
          Generic mutator for messageClass
 void setMessageClass(java.lang.String messageClass)
          Mutator for messageClass
 MessageDescription shallowCopy()
          Make a shallow copy of this MessageDescription.
 int sizeofDescription()
          Returns the size of description.
 java.lang.String toString()
          Return a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MessageDescription

public MessageDescription()
Default constructor calls init.

Method Detail

getPrintname

public java.lang.String getPrintname()
Return the printname of the class

Specified by:
getPrintname in interface SandStructMessage

fieldHasFlag

public boolean fieldHasFlag(java.lang.String fieldname,
                            int fieldflag)
Return true if the named field declares the indicated flag, false otherwise. See the FIELDFLAG* constants in SandInstanceMessage for supported fieldflag values.

Specified by:
fieldHasFlag in interface SandInstanceMessage

getMessageClass

public java.lang.String getMessageClass()
Accessor for messageClass


setMessageClass

public void setMessageClass(java.lang.String messageClass)
Mutator for messageClass


setMessageClass

public void setMessageClass(java.lang.Object messageClass)
Generic mutator for messageClass


getMessageClassFlag

public static boolean getMessageClassFlag(int fieldflag)
Field flag accessor. Returns whether the given FIELDFLAG_* (defined in SandInstanceMessage) is true or false.


getMessageClassLengthNorm

public static int getMessageClassLengthNorm()
Normal messageClass length is 60 characters


getMessageClassLengthMax

public static int getMessageClassLengthMax()
Maximum messageClass length is 80 characters


getMessageClassDefaultValue

public static java.lang.String getMessageClassDefaultValue()
Default value for messageClass. Returns ""


getMessageClassInvalidValue

public static java.lang.String getMessageClassInvalidValue()
Invalid value for messageClass. Returns "SANDEV_INVALID_MESSAGE_CLASS"


getMessageClassPrintValue

public java.lang.String getMessageClassPrintValue()
Retrieve the current value of this field as a print String. For a String field, this returns the current value. For int, long, double this returns the standard string conversion. For a Date, this returns the default DateFormat format. For an enum, this returns the Actual2Print translation of the current value. For a struct this returns a summary description.

Used for debug output, and as an initial value for transformation and formatting.


getMessageClassFieldPrintValue

public java.lang.String getMessageClassFieldPrintValue()
Return the print name of the messageClass field. If no printname is declared then this returns the field name.


getMessageClassRange

public java.lang.String getMessageClassRange()
Return the range specification for this field


getMessageClassValidityCheck

public java.lang.String getMessageClassValidityCheck()
Return the empty string if the value of this field is valid according to the base SAND declarations. This method supports the fieldValidate method, which is in turn specified by the org.sandev.basics.structs.SandInstanceMessage interface. See the comments there for more information, including a list of error Strings returned from here when a field is not valid.


getMessageClassMetatype

public java.lang.String getMessageClassMetatype()
Return the metatype text for this field, or "" if no metatype was declared.


getDescription

public SandAttrVal[] getDescription()
Accessor for description. The returned value may or may not be the actual data member. Always write back a changed array using setDescription.


setDescription

public void setDescription(SandAttrVal[] description)
Mutator for description


setDescription

public void setDescription(java.lang.Object[] description)
Generic mutator for description


addDescription

public void addDescription(SandAttrVal element)
Appends a value to description


addDescription

public void addDescription(SandAttrVal[] elements)
Appends an array of values to description


getDescription

public SandAttrVal getDescription(int index)
Returns the element at the specified index. Returns null if description is null or smaller than index.


setDescription

public void setDescription(int index,
                           SandAttrVal value)
Set the value at the index specified.


insertDescription

public void insertDescription(int index,
                              SandAttrVal value)
Insert the specified element at the specified index. If the index specified is greater than the index of the last element, then the value is appended to the existing array.


removeDescription

public SandAttrVal removeDescription(int index)
Remove the element at the specified index and return it.


removeDescriptionValue

public boolean removeDescriptionValue(SandAttrVal value)
Removes the given element from description. Returns true if the element was found.


clearDescription

public void clearDescription()
Clears all values from description


descriptionContains

public boolean descriptionContains(SandAttrVal val)
Returns true if description contains the specified value.


descriptionIndexOf

public int descriptionIndexOf(SandAttrVal val)
Return the index of the specified value in description, or -1 if not found.


sizeofDescription

public int sizeofDescription()
Returns the size of description. Returns -1 if description is null.


getDescriptionFlag

public static boolean getDescriptionFlag(int fieldflag)
Field flag accessor. Returns whether the given FIELDFLAG_* (defined in SandInstanceMessage) is true or false.


getDescriptionDefaultValue

public static SandAttrVal[] getDescriptionDefaultValue()
Default value for description. Returns new SandAttrVal[0]


getDescriptionElementInvalidValue

public static SandAttrVal getDescriptionElementInvalidValue()
Invalid value for descriptionelement. Returns null


getDescriptionInvalidValue

public static SandAttrVal[] getDescriptionInvalidValue()
Invalid value for description. Returns null


getDescriptionPrintValue

public java.lang.String getDescriptionPrintValue()
Retrieve the current value of this field as a print String. For a String field, this returns the current value. For int, long, double this returns the standard string conversion. For a Date, this returns the default DateFormat format. For an enum, this returns the Actual2Print translation of the current value. For a struct this returns a summary description.

Used for debug output, and as an initial value for transformation and formatting.


getDescriptionFieldPrintValue

public java.lang.String getDescriptionFieldPrintValue()
Return the print name of the description field. If no printname is declared then this returns the field name.


getDescriptionRange

public java.lang.String getDescriptionRange()
Return the range specification for this field


getDescriptionValidityCheck

public java.lang.String getDescriptionValidityCheck()
Return the empty string if the value of this field is valid according to the base SAND declarations. This method supports the fieldValidate method, which is in turn specified by the org.sandev.basics.structs.SandInstanceMessage interface. See the comments there for more information, including a list of error Strings returned from here when a field is not valid.


getDescriptionMetatype

public java.lang.String getDescriptionMetatype()
Return the metatype text for this field, or "" if no metatype was declared.


init

public void init()
Initialize all fields to their default values


getShortName

public java.lang.String getShortName()
Returns the unqualified name of this message.

Specified by:
getShortName in interface SandMessage

getQueryMessage

public SandQueryMessage getQueryMessage()
Returns null

Specified by:
getQueryMessage in interface SandMessage

getCollectionMessage

public SandCollectionMessage getCollectionMessage()
Returns null

Specified by:
getCollectionMessage in interface SandMessage

getUpdateMessage

public SandUpdateMessage getUpdateMessage()
Returns null

Specified by:
getUpdateMessage in interface SandMessage

getStructMessage

public SandStructMessage getStructMessage()
Returns a new MessageDescription instance

Specified by:
getStructMessage in interface SandMessage

isEquivalent

public boolean isEquivalent(SandMessage sm)
Declared field equivalence check as specified by the SandMessage interface. String values are trimmed before comparison because conversions may occasionally result in trailing whitespace, which should not cause equivalence comparisons to fail. Comparisons are case insensitive since that corresponds to what most people expect, and how most databases work.

When comparing arrays, it is possible that the array elements may have been set to null as part of authorization filtering or similar unusual circumstances. A null array element is only equivalent to another null array element.

Specified by:
isEquivalent in interface SandMessage

getBaseMemoryUse

public int getBaseMemoryUse()
Return the base memory use for this object. This number is a minimum value for estimation purposes, see the comments in the SandStructMessage declaration for details.

Specified by:
getBaseMemoryUse in interface SandMessage

generalModifier

public void generalModifier(int action,
                            java.lang.String field,
                            int index,
                            java.lang.Object val)
                     throws SandException
General mutator method. Specified by SandInstanceMessage interface.

Specified by:
generalModifier in interface SandInstanceMessage
Throws:
SandException

generalDereference

public SandAttrVal generalDereference(java.lang.String fieldspec)
General reference field accessor method. Specified by SandInstanceMessage interface.

Specified by:
generalDereference in interface SandInstanceMessage

generalAccessor

public java.lang.Object generalAccessor(java.lang.String fieldspec)
General field accessor method. Specified by SandInstanceMessage interface.

Specified by:
generalAccessor in interface SandInstanceMessage

getDisplayFields

public java.lang.String[] getDisplayFields()
Return an array of the summary field names for this class.

Specified by:
getDisplayFields in interface SandInstanceMessage

getDisplayFieldsPrint

public java.lang.String[] getDisplayFieldsPrint()
Return an array of the summary field print names for this class.

Specified by:
getDisplayFieldsPrint in interface SandInstanceMessage

getLayoutXML

public java.lang.String getLayoutXML()
Return the fieldlayout XML or null if not defined.

Specified by:
getLayoutXML in interface SandInstanceMessage

getDisplayValues

public java.lang.String[] getDisplayValues()
Return the values for the summary fields. The standard String representation of each value is returned. For Dates, the default DateFormat output is used. For enums, the print value is used. These can be further transformed as needed.

Specified by:
getDisplayValues in interface SandInstanceMessage

getDisplayValues

public java.lang.String[] getDisplayValues(IDLookup lookup,
                                           AuthUser user,
                                           java.lang.String defaultVal)
Return the values for the summary fields, including dereference expressions.

Specified by:
getDisplayValues in interface Resolvable

getValueForFieldName

public java.lang.String getValueForFieldName(java.lang.String fieldname,
                                             IDLookup lookup,
                                             AuthUser user,
                                             java.lang.String defaultVal)
Returns the print representation of the value of the specified field, or the given default value if innaccessible. A field value may be innaccessible due to authorization, null reference, or other call failure.


getAllFields

public java.lang.String[] getAllFields()
Return an array of all fields for this class.

Specified by:
getAllFields in interface SandInstanceMessage

getContainedMessageFields

public java.lang.String[] getContainedMessageFields()
Return an array of all contained message fields.

Specified by:
getContainedMessageFields in interface SandInstanceMessage

defaultField

public void defaultField(java.lang.String fieldname)
Set the specified field to its default value.

Specified by:
defaultField in interface SandInstanceMessage

getPrintnameForField

public java.lang.String getPrintnameForField(java.lang.String fieldname)
Given a fieldname, return its declared printname if declared. If no printname was declared then this returns the field name.

Specified by:
getPrintnameForField in interface SandInstanceMessage

cloneMessage

public SandInstanceMessage cloneMessage()
Calls cloneMessageDescription

Specified by:
cloneMessage in interface SandInstanceMessage

cloneMessageDescription

public MessageDescription cloneMessageDescription()
Make a deep copy of this MessageDescription. Creates a new instance and then calls copyDataFrom.


shallowCopy

public MessageDescription shallowCopy()
Make a shallow copy of this MessageDescription. Creates a new instance and then calls copyDataFrom.


copyDataFrom

public void copyDataFrom(MessageDescription other,
                         boolean deepcopy)
Copy all the data from the specified instance. If the other instance is null then this method does nothing. If deepcopy is specified then contained structs are copied, otherwise not. The one field this does not copy is instanceWriteAccess, since you need the copied instance to be writeable.


copyFieldValue

public void copyFieldValue(java.lang.String fieldName,
                           SandInstanceMessage other)
Copy the specified field from the given instance.

Specified by:
copyFieldValue in interface SandInstanceMessage

fieldValidate

public SandAttrVal[] fieldValidate(SandAttrVal[] checkFields)
Validate the fields as specified in the SandInstanceMessage interface

Specified by:
fieldValidate in interface SandInstanceMessage

fieldsValid

public boolean fieldsValid()
Validate the fields as specified in the SandInstanceMessage interface

Specified by:
fieldsValid in interface SandInstanceMessage

referenceValidate

public java.lang.String[] referenceValidate(java.lang.String[] locations,
                                            java.lang.String prefix,
                                            IDLookup idlookup,
                                            NameLookup namelookup,
                                            AuthUser au)
                                     throws SandException
Validate the references as specified in the Resolvable interface.

Specified by:
referenceValidate in interface Resolvable
Throws:
SandException

convertToSuperstructClass

public SandInstanceMessage convertToSuperstructClass()
Return a new instance of the message associated with the superstruct of this instance. Return null if the source struct for this message does not extend another struct.

Specified by:
convertToSuperstructClass in interface SandInstanceMessage

debugDump

public java.lang.String debugDump(java.lang.String prefix)
Dump this instance into a debug printable string.

Specified by:
debugDump in interface SandInstanceMessage

getDisplayID

public java.lang.String getDisplayID()
Return the displayID for this message instance

Specified by:
getDisplayID in interface SandInstanceMessage

getInstance

public SandPersistMessage getInstance(java.lang.String classname,
                                      long id)
If this instance directly contains the specified instance, then find it and return it. Returns null if not found.

Specified by:
getInstance in interface SandStructMessage

getInstance

public SandInstanceMessage getInstance(java.lang.String classname,
                                       java.lang.String fieldname,
                                       java.lang.String value)
If this instance directly contains the specified instance, then find it and return it. Returns null if not found.

Specified by:
getInstance in interface SandStructMessage

find

public SandCollectionMessage find(SandQueryMessage sqm)
Return a matching collection of all directly contained instances matching the given query.

Specified by:
find in interface SandStructMessage

toString

public java.lang.String toString()
Return a string representation of this object. Uses the declared summary fields minus any dereference expressions.

Overrides:
toString in class java.lang.Object