Project Wonder 2.0

com.gammastream.validity
Class GSVRule

java.lang.Object
  extended bycom.gammastream.validity.GSVRule
All Implemented Interfaces:
WOXMLCoding

public final class GSVRule
extends Object
implements WOXMLCoding

This structure stores the various information which defines each rule. Information like the name, where the rule is located, error messages, when to execute, etc.

Author:
GammaStream Technologies, Inc.

Constructor Summary
GSVRule(String rName, String cName2, String mName2, String eMessage, String doc)
          Creates a new GSVRule with the provided parameters.
GSVRule(WOXMLDecoder decoder)
          WOXMLCoding Impl
 
Method Summary
 Class classForCoder()
          WOXMLCoding Impl
 String cName()
          Returns the fully qualified class name of the class in which the method used in this rule is located. :-)
 boolean continueIfNULL()
           
 String documentation()
          Returns the documentation for this rule.
 void encodeWithWOXMLCoder(WOXMLCoder coder)
          WOXMLCoding Impl
 String errorMessage()
          Returns the error message that should be displayed to the user when this rule fails to be validated.
 boolean failIfNULL()
           
 String mName()
          Returns the method name used for this rule.
 boolean negate()
          Should the outcome of this rule be negated (reversed).
 boolean onDelete()
           
 boolean onInsert()
           
 boolean onSave()
           
 boolean onUpdate()
           
 NSMutableDictionary parameters()
          Returns a dictionary of key-value pairs used for providing parameters to the validation rule's method.
 String ruleName()
          Returns the name of this rule.
 void setCName(String newClass)
          Set the class name for this rule.
 void setContinueIfNULL(boolean z)
           
 void setDocumentation(String doc)
          Set the documentation to the provided String.
 void setErrorMessage(String newMessage)
          Set the error message.
 void setFailIfNULL(boolean z)
           
 void setMName(String newMethod)
          Set the method name for this rule.
 void setNegate(boolean z)
          Assigns a key-value pair dictionary to this rule.
 void setOnDelete(boolean z)
           
 void setOnInsert(boolean z)
           
 void setOnSave(boolean z)
           
 void setOnUpdate(boolean z)
           
 void setParameters(NSMutableDictionary newParameters)
          Assigns a key-value pair dictionary to this rule.
 void setRuleName(String newRule)
          Sets the name of this rule.
 void setStopIfFails(boolean z)
           
 boolean stopIfFails()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GSVRule

public GSVRule(String rName,
               String cName2,
               String mName2,
               String eMessage,
               String doc)
        throws IllegalArgumentException
Creates a new GSVRule with the provided parameters.

Parameters:
rName - The name you wish to give the rule.
cName2 - The fully qualified class name in which the rule's method is located.
mName2 - The name of the method to be executed.
eMessage - An error message to provide the user in the event the rule fails.
doc - Optional documentation as to the rules function.
Throws:
IllegalArgumentException - Thrown should the class name or method name appear to be invalid.

GSVRule

public GSVRule(WOXMLDecoder decoder)
WOXMLCoding Impl

Parameters:
decoder - WOXMLDecoder
See Also:
encodeWithWOXMLCoder(com.webobjects.appserver.xml.WOXMLCoder)
Method Detail

ruleName

public String ruleName()
Returns the name of this rule.

Returns:
The name of the rule.
See Also:
setRuleName(java.lang.String)

setRuleName

public void setRuleName(String newRule)
                 throws IllegalArgumentException
Sets the name of this rule.

Throws:
IllegalArgumentException
See Also:
ruleName()

cName

public String cName()
Returns the fully qualified class name of the class in which the method used in this rule is located. :-)

Returns:
The name of the rule.
See Also:
setCName(java.lang.String)

setCName

public void setCName(String newClass)
              throws IllegalArgumentException
Set the class name for this rule.

Throws:
IllegalArgumentException - Thrown should the class name appear to be invalid. Currently the validation logic here always returns true.
See Also:
cName()

mName

public String mName()
Returns the method name used for this rule.

Returns:
The method name.
See Also:
setMName(java.lang.String)

setMName

public void setMName(String newMethod)
              throws IllegalArgumentException
Set the method name for this rule.

Throws:
IllegalArgumentException - Thrown should the method name appear to be invalid. Currently the validation logic here always returns true.
See Also:
mName()

errorMessage

public String errorMessage()
Returns the error message that should be displayed to the user when this rule fails to be validated.

Returns:
The error message.
See Also:
setErrorMessage(java.lang.String)

setErrorMessage

public void setErrorMessage(String newMessage)
Set the error message.

See Also:
errorMessage()

documentation

public String documentation()
Returns the documentation for this rule.

Returns:
The documentation.
See Also:
setDocumentation(java.lang.String)

setDocumentation

public void setDocumentation(String doc)
Set the documentation to the provided String.

See Also:
documentation()

parameters

public NSMutableDictionary parameters()
Returns a dictionary of key-value pairs used for providing parameters to the validation rule's method. This parameter dictionary is passed to the method defined by mName().

Returns:
The key-values pairs.
See Also:
setParameters(com.webobjects.foundation.NSMutableDictionary)

setParameters

public void setParameters(NSMutableDictionary newParameters)
Assigns a key-value pair dictionary to this rule.

See Also:
parameters()

negate

public boolean negate()
Should the outcome of this rule be negated (reversed). This might be useful if you have a method which returns true if you have a String which is empty or null. Your rule might indicate that you want this attribute to be required. If the method returns true if it is, you will want to reverse the outcome. Did that make any sense?

Returns:
Whether the initial return value should be negated (reversed).
See Also:
setNegate(boolean)

setNegate

public void setNegate(boolean z)
Assigns a key-value pair dictionary to this rule.

See Also:
parameters()

failIfNULL

public boolean failIfNULL()

setFailIfNULL

public void setFailIfNULL(boolean z)

continueIfNULL

public boolean continueIfNULL()

setContinueIfNULL

public void setContinueIfNULL(boolean z)

stopIfFails

public boolean stopIfFails()

setStopIfFails

public void setStopIfFails(boolean z)

onSave

public boolean onSave()

setOnSave

public void setOnSave(boolean z)

onUpdate

public boolean onUpdate()

setOnUpdate

public void setOnUpdate(boolean z)

onInsert

public boolean onInsert()

setOnInsert

public void setOnInsert(boolean z)

onDelete

public boolean onDelete()

setOnDelete

public void setOnDelete(boolean z)

encodeWithWOXMLCoder

public void encodeWithWOXMLCoder(WOXMLCoder coder)
WOXMLCoding Impl

Specified by:
encodeWithWOXMLCoder in interface WOXMLCoding
Parameters:
coder - WOXMLCoder
See Also:
GSVRule(com.webobjects.appserver.xml.WOXMLDecoder)

classForCoder

public Class classForCoder()
WOXMLCoding Impl

Specified by:
classForCoder in interface WOXMLCoding

Last updated: Do, Dez 9, 2004 • 12:46 PM CET

Copyright © 2002 – 2004 Project Wonder.