com.sri.emo.dbobj
Class PartsFactory

java.lang.Object
  extended by com.sri.emo.dbobj.PartsFactory

public class PartsFactory
extends Object

Factory for determing the parts of each type of node.


Field Summary
static String DELIMITER
           
 
Constructor Summary
PartsFactory()
           
 
Method Summary
static void addFakeType(NodeType type)
          add a new fake type; fake types are just used for getting list of all types (for footer)
static void addType(NodeType type)
          add a new type; typically, there will be no parts associated with new type, but an empty array will be added to hash
static Hashtable getAllParts()
           
static Part getAttribPart(String srcNodetype, String attribName)
           
static String getAttributeType(String type, int attribNum)
          necessary since the JSP doesn't know anything, but must iterate to display attributes and send back edits with some discernable connection between input text and attribute destination.
static TreeSet getEntities()
           
static NodeType getEntity(String nodeType)
           
static ArrayList getFakeEntities()
           
static org.apache.log4j.Category getLogger()
          convenience for getting logger for current (sub) class
static Part getPart(int partId)
          convenience method to get part from ID; hits db, so not as effective as other methods which retrieve from hash table.
static Part getPart(String partId)
          convenience method to get part from ID; hits db, so not as effective as other methods which retrieve from hash table.
static Part getPart(String parentType, String partType, String relation)
           
static Part[] getParts(String nodeType)
           
static Part[] getPartsWithPicklists()
           
static void refreshCache(String parentType)
          after adding or deleting parts, call this
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DELIMITER

public static final String DELIMITER
See Also:
Constant Field Values
Constructor Detail

PartsFactory

public PartsFactory()
Method Detail

addType

public static void addType(NodeType type)
                    throws DBException
add a new type; typically, there will be no parts associated with new type, but an empty array will be added to hash

Throws:
DBException

addFakeType

public static void addFakeType(NodeType type)
                        throws DBException
add a new fake type; fake types are just used for getting list of all types (for footer)

Throws:
DBException

getParts

public static Part[] getParts(String nodeType)
Returns:
a list of parts for paradigms, or empty array if not found; never null

getAttributeType

public static String getAttributeType(String type,
                                      int attribNum)
                               throws DBException
necessary since the JSP doesn't know anything, but must iterate to display attributes and send back edits with some discernable connection between input text and attribute destination.

Parameters:
type - type of node
attribNum - number of attribute in parts list of node
Returns:
name of attribute which corresponds to given type, num. return null if cannot find
Throws:
DBException

getAttribPart

public static Part getAttribPart(String srcNodetype,
                                 String attribName)
Returns:
part corresponding to node, attrib params; null if not found

getPartsWithPicklists

public static Part[] getPartsWithPicklists()
                                    throws DBException
Returns:
array of parts that have picklists (i.e., the values for the part are chosen from a closed list, like the type of a MeasurementModel)
Throws:
DBException

getAllParts

public static Hashtable getAllParts()

getPart

public static Part getPart(String parentType,
                           String partType,
                           String relation)
                    throws DBException
Parameters:
relation - relation for this part; pass in null for owned attributes
Returns:
first part which matches partType, or null if not found
Throws:
DBException

refreshCache

public static void refreshCache(String parentType)
                         throws DBException
after adding or deleting parts, call this

Throws:
DBException

getEntity

public static NodeType getEntity(String nodeType)
Returns:
a nodetype for the given string, or null if not found

getEntities

public static TreeSet getEntities()
Returns:
list of REGISTERED NodeType objects. this may exclude actual DB types that are not registered with partFactory. this method is more efficent since it uses cache.
See Also:
for a complete list of DB entries, though it is less efficient than this method, addType(com.sri.emo.dbobj.NodeType), getFakeEntities()

getFakeEntities

public static ArrayList getFakeEntities()
Returns:
array of fake node types.
See Also:
addFakeType(com.sri.emo.dbobj.NodeType)

getLogger

public static org.apache.log4j.Category getLogger()
convenience for getting logger for current (sub) class

Returns:
Category for logging

getPart

public static Part getPart(int partId)
                    throws DBException
convenience method to get part from ID; hits db, so not as effective as other methods which retrieve from hash table.

Returns:
part with given ID, or null if not found.
Throws:
DBException

getPart

public static Part getPart(String partId)
                    throws DBException
convenience method to get part from ID; hits db, so not as effective as other methods which retrieve from hash table.

Returns:
part with given ID, or null if not found.
Throws:
DBException


Copyright © 2004-2006 Codeguild, Inc.. All Rights Reserved.