Project Wonder 5.0

com.gammastream.validity
Class GSVModel

java.lang.Object
  extended by com.gammastream.validity.GSVModel
All Implemented Interfaces:
com.webobjects.appserver.xml.WOXMLCoding

public final class GSVModel
extends java.lang.Object
implements com.webobjects.appserver.xml.WOXMLCoding

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.webobjects.appserver.xml.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.webobjects.appserver.xml.WOXMLCoder coder)
          WOXMLCoding Impl
 com.webobjects.foundation.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.webobjects.foundation.NSArray entityNames()
          Returns an NSArray containing the GSVEntity names.
 com.webobjects.eoaccess.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 init(com.webobjects.eoaccess.EOModel eomodel)
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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'

See Also:
Constant Field Values

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'

See Also:
Constant Field Values
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.webobjects.appserver.xml.WOXMLDecoder decoder)
WOXMLCoding Impl

Parameters:
decoder - WOXMLDecoder
See Also:
encodeWithWOXMLCoder(com.webobjects.appserver.xml.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.webobjects.eoaccess.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.webobjects.foundation.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.webobjects.foundation.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.webobjects.appserver.xml.WOXMLCoder coder)
WOXMLCoding Impl

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

classForCoder

public java.lang.Class classForCoder()
WOXMLCoding Impl

Specified by:
classForCoder in interface com.webobjects.appserver.xml.WOXMLCoding

init

public void init(com.webobjects.eoaccess.EOModel eomodel)

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.