com.gammastream.validity
Class GSVModel

com.gammastream.validity.GSVModel

public final class GSVModel

GSVModel used for the mapping validation rules to an entities' attributes.
The structure is very similar to Apple's EOModel.

Author:
GammaStream Technologies, Inc.

Field Summary
static java.lang.String MODEL_EXTENSION
          The extension of the GSVModel file included in the '.eomodeld' wrapper.
Currently the full name is: 'Validity.model'
static java.lang.String MODEL_NAME
          The name of the GSVModel file included in the '.eomodeld' wrapper.
Currently the full name is: 'Validity.model'
 
Constructor Summary
GSVModel(java.lang.String path)
          Creates a new GSVModel using the path to an '.eomodeld' file.

Example of creating a GSVModel for the Movies example which ships with WebObjects.

EOModel eoModel = EOModelGroup.defaultGroup().modelNamed("Moview");
GSVModel model = new GSVModel(eoModel.path());
GSVModel(com.gammastream.validity.WOXMLDecoder decoder)
          WOXMLCoding Impl
 
Method Summary
 void addEntity(GSVEntity newEntity)
          Adds a GSVEntity object to this GSVModel.
 java.lang.Class classForCoder()
          WOXMLCoding Impl
 void encodeWithWOXMLCoder(com.gammastream.validity.WOXMLCoder coder)
          WOXMLCoding Impl
 com.gammastream.validity.NSArray entities()
          Returns the NSArray of GSVEntity Objects.
 GSVEntity entityForObject(java.lang.Object object)
          Returns the GSVEntity object associated with the provided EOEnterpriseObject.
 GSVEntity entityNamed(java.lang.String name)
          Returns the GSVEntity object for the provided entity name.
 com.gammastream.validity.NSArray entityNames()
          Returns an NSArray containing the GSVEntity names.
 com.gammastream.validity.EOModelGroup eomodelGroup()
          Returns the EOModelGroup that is being used to query information from the EOModel.
 java.lang.String eomodelName()
          Returns the EOModel Name for the associated GSVModel.
 java.lang.String eomodelPath()
          Returns the path of the '.eomodeld' file.
 void removeEntity(GSVEntity oldEntity)
          Removes a GSVEntity object from this GSVModel.
 boolean saveModel()
          Saves the GSVModel to inside the '.eomodeld' file wrapper.
 void savePath(java.lang.String s)
          Internal method for saving paths
 void setEomodelPath(java.lang.String path)
          Set the path of the EOModel file.
 boolean validateEOModelForPath(java.lang.String path)
          Determines that there is indeed a file located at the given path.
 

Field Detail

MODEL_NAME

public static final java.lang.String MODEL_NAME
The name of the GSVModel file included in the '.eomodeld' wrapper.
Currently the full name is: 'Validity.model'

MODEL_EXTENSION

public static final java.lang.String MODEL_EXTENSION
The extension of the GSVModel file included in the '.eomodeld' wrapper.
Currently the full name is: 'Validity.model'
Constructor Detail

GSVModel

public GSVModel(java.lang.String path)
         throws java.lang.IllegalArgumentException
Creates a new GSVModel using the path to an '.eomodeld' file.

Example of creating a GSVModel for the Movies example which ships with WebObjects.

EOModel eoModel = EOModelGroup.defaultGroup().modelNamed("Moview");
GSVModel model = new GSVModel(eoModel.path());
Parameters:
path - Path to an '.eomodeld' file.
Throws:
java.lang.IllegalArgumentException - Thrown if valid '.eomodeld' file does not exist at the specified path.

GSVModel

public GSVModel(com.gammastream.validity.WOXMLDecoder decoder)
WOXMLCoding Impl
Parameters:
decoder - WOXMLDecoder
See Also:
encodeWithWOXMLCoder(com.gammastream.validity.WOXMLCoder)
Method Detail

validateEOModelForPath

public boolean validateEOModelForPath(java.lang.String path)
Determines that there is indeed a file located at the given path.
Parameters:
path - Path to the desired '.eomodeld' file.
Returns:
true if an '.eomodeld' file is located at the given path; otherwise, we return false.

saveModel

public boolean saveModel()
Saves the GSVModel to inside the '.eomodeld' file wrapper.
Returns:
true if save is successful; otherwise, returns false.

eomodelGroup

public com.gammastream.validity.EOModelGroup eomodelGroup()
Returns the EOModelGroup that is being used to query information from the EOModel.
Returns:
EOModelGroup for the EOModel.

eomodelName

public java.lang.String eomodelName()
Returns the EOModel Name for the associated GSVModel.
Returns:
Name of the EOModel

eomodelPath

public java.lang.String eomodelPath()
Returns the path of the '.eomodeld' file.
Returns:
Path of the EOModel File.
See Also:
setEomodelPath(java.lang.String)

setEomodelPath

public void setEomodelPath(java.lang.String path)
Set the path of the EOModel file.
Parameters:
path - Path of the EOModel File.
See Also:
eomodelPath()

entities

public com.gammastream.validity.NSArray entities()
Returns the NSArray of GSVEntity Objects.
Returns:
NSArray of GSVEntity Objects.
See Also:
addEntity(com.gammastream.validity.GSVEntity), removeEntity(com.gammastream.validity.GSVEntity)

addEntity

public void addEntity(GSVEntity newEntity)
               throws java.lang.IllegalArgumentException
Adds a GSVEntity object to this GSVModel. The GSVEntity must not already exsit.
If it does, IllegalArgumentException is thrown.
Parameters:
newEntity - GSVEntity object
Throws:
java.lang.IllegalArgumentException - GSVEnitity already exsits.
See Also:
entities(), removeEntity(com.gammastream.validity.GSVEntity)

removeEntity

public void removeEntity(GSVEntity oldEntity)
Removes a GSVEntity object from this GSVModel.
Parameters:
oldEntity - GSVEntity object to remove.
See Also:
entities(), addEntity(com.gammastream.validity.GSVEntity)

entityForObject

public GSVEntity entityForObject(java.lang.Object object)
Returns the GSVEntity object associated with the provided EOEnterpriseObject.
Parameters:
object - EOEnterpriseObject
Returns:
GSVEntity if the EOEnterpriseObject has an GSVEntity Null if not.
See Also:
entityNamed(java.lang.String)

entityNamed

public GSVEntity entityNamed(java.lang.String name)
Returns the GSVEntity object for the provided entity name.
Parameters:
name - name of entity
Returns:
GSVEntity if an GSVEntity is named name, null if it could not be found.
See Also:
entityForObject(java.lang.Object)

entityNames

public com.gammastream.validity.NSArray entityNames()
Returns an NSArray containing the GSVEntity names.
Returns:
NSArray names of GSVEntities.

savePath

public void savePath(java.lang.String s)
Internal method for saving paths

encodeWithWOXMLCoder

public void encodeWithWOXMLCoder(com.gammastream.validity.WOXMLCoder coder)
WOXMLCoding Impl
Parameters:
coder - WOXMLCoder
See Also:
GSVModel(java.lang.String)

classForCoder

public java.lang.Class classForCoder()
WOXMLCoding Impl