Project Wonder 2.0

com.gammastream.validity
Class GSVModel

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

public final class GSVModel
extends Object
implements 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 String MODEL_EXTENSION
          The extension of the GSVModel file included in the '.eomodeld' wrapper.
static String MODEL_NAME
          The name of the GSVModel file included in the '.eomodeld' wrapper.
 
Constructor Summary
GSVModel(String path)
          Creates a new GSVModel using the path to an '.eomodeld' file.
GSVModel(WOXMLDecoder decoder)
          WOXMLCoding Impl
 
Method Summary
 void addEntity(GSVEntity newEntity)
          Adds a GSVEntity object to this GSVModel.
 Class classForCoder()
          WOXMLCoding Impl
 void encodeWithWOXMLCoder(WOXMLCoder coder)
          WOXMLCoding Impl
 NSArray entities()
          Returns the NSArray of GSVEntity Objects.
 GSVEntity entityForObject(Object object)
          Returns the GSVEntity object associated with the provided EOEnterpriseObject.
 GSVEntity entityNamed(String name)
          Returns the GSVEntity object for the provided entity name.
 NSArray entityNames()
          Returns an NSArray containing the GSVEntity names.
 EOModelGroup eomodelGroup()
          Returns the EOModelGroup that is being used to query information from the EOModel.
 String eomodelName()
          Returns the EOModel Name for the associated GSVModel.
 String eomodelPath()
          Returns the path of the '.eomodeld' file.
 void init(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(String s)
          Internal method for saving paths
 void setEomodelPath(String path)
          Set the path of the EOModel file.
 boolean validateEOModelForPath(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 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 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(String path)
         throws 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:
IllegalArgumentException - Thrown if valid '.eomodeld' file does not exist at the specified path.

GSVModel

public GSVModel(WOXMLDecoder decoder)
WOXMLCoding Impl

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

validateEOModelForPath

public boolean validateEOModelForPath(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 EOModelGroup eomodelGroup()
Returns the EOModelGroup that is being used to query information from the EOModel.

Returns:
EOModelGroup for the EOModel.

eomodelName

public String eomodelName()
Returns the EOModel Name for the associated GSVModel.

Returns:
Name of the EOModel

eomodelPath

public 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(String path)
Set the path of the EOModel file.

Parameters:
path - Path of the EOModel File.
See Also:
eomodelPath()

entities

public 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 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:
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(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(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 NSArray entityNames()
Returns an NSArray containing the GSVEntity names.

Returns:
NSArray names of GSVEntities.

savePath

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


encodeWithWOXMLCoder

public void encodeWithWOXMLCoder(WOXMLCoder coder)
WOXMLCoding Impl

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

classForCoder

public Class classForCoder()
WOXMLCoding Impl

Specified by:
classForCoder in interface WOXMLCoding

init

public void init(EOModel eomodel)

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

Copyright © 2002 – 2004 Project Wonder.