wt.clients.beans
Class AssociationsLogic

java.lang.Object
  extended bywt.clients.beans.AssociationsLogic

public class AssociationsLogic
extends Object

This class contains the task logic for the AssociationsPanel. It assumes a BinaryLink between two Persitables.

Supported API: true.

Extendable: true.


Field Summary
protected static AttributeHelper attributeHelper
           
private  ClassInfo classInfo
           
private static boolean DEBUG
           
private static IconCache iconCache
           
private  String linkClassName
           
private  AssociationsModel model
           
private  Object object
           
private  Class objectClass
           
private  String[] otherSideAttributes
           
private  Class otherSideClass
           
private  String role
           
private  String standardIconResource
           
 
Constructor Summary
AssociationsLogic()
          No arg constructor for AssociationsLogic

Supported API: true.
 
Method Summary
protected  BinaryLink createNewLink(Persistable added_object)
          This creates a new link between this side object and an added other-side object using the linkClass.
private  void debug(String message)
           
 String getAttrValue(Object obj, Method getter)
          This invokes the getter on the object passed in and returns the string value representing that object.
 String getAttrValue(Object obj, String attribute)
           
 ClassInfo getClassInfo()
          This returns the ClassInfo for the current object whose links are being manipulated.
 String getDisplayName(String attribute, String class_name)
          This uses introspection to find the display name for the passed in attribute and the passed in class_name.
 Method getGetterMethod(String attribute, Object object)
          This uses introspection to find the getter method for the object passed in and it's attribute.
 Class getLinkClass()
          This is the public getter for the link class being displayed in the multilist and being created, updated, or viewed.
 String getLinkClassName()
          This is the public getter for the name of the link class being displayed in the multilist and being created, updated, or viewed.
 AssociationsModel getModel()
          Get the model used to navigate the association

Supported API: true.
 Object getObject()
          This is the getter for the object for which the links can be created, updated, and viewed.
 Class getObjectClass()
          This returns the Class for which the links are being displayed in the multilist.
 String[] getOtherSideAttributes()
          This returns an array of attributes on the other side object that are displayed in the columns of the multilist.
 Class getOtherSideClass()
          This returns the class on the other side of the link.
 Object getRelations()
          This method navigates the links on the object and returns all links that are of the same class as the linkClass.
 String getRole()
          This is the getter of the role of the other side object.
protected  String getSimpleName(Class a_class)
          Helper method to get the name of the class without the package qualification.
 Image getStandardIcon(WTObject myObject, WTContext context)
          Returns an Image that symbolically represents the object instance or class.
protected  void initClassInfo()
          This initializes the classInfo variable with a new instance of ClassInfo for the current objectClass

Supported API: true.
private  void initIconCache()
           
 boolean isPersistent(Persistable persistable)
          Tests to see if the Peristable parameter is persistent in the database.
 void save(Enumeration removed_links, Hashtable links)
          This persists any new links that the user created, and any links that the user updated.
 void setLinkClassName(String class_name)
          This is the public setter for the name of the link class to be displayed in the multilist and created, updated, or viewed.
 void setModel(AssociationsModel model)
          Set the model used to navigate the association

Supported API: true.
 void setObject(Object object)
          This sets the object for which the links can be created, updated, and viewed.
 void setObjectClass(Class object_class)
          This is the public setter for the class to be displayed in the multilist and created, updated, or viewed.
 void setOtherSideAttributes(String[] attributes)
          This sets the attributes on the other side object that will be displayed in the columns of the multilist.
 void setOtherSideClass(Class other_side)
          This sets the class on the other side of the link.
 void setRole(String role)
          Call this to set the role of the other side object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

standardIconResource

private String standardIconResource

iconCache

private static IconCache iconCache

otherSideAttributes

private String[] otherSideAttributes

object

private Object object

objectClass

private Class objectClass

role

private String role

otherSideClass

private Class otherSideClass

linkClassName

private String linkClassName

classInfo

private ClassInfo classInfo

model

private AssociationsModel model

attributeHelper

protected static AttributeHelper attributeHelper
Constructor Detail

AssociationsLogic

public AssociationsLogic()
No arg constructor for AssociationsLogic

Supported API: true.

Method Detail

setObject

public void setObject(Object object)
This sets the object for which the links can be created, updated, and viewed.

Supported API: true.


getObject

public Object getObject()
This is the getter for the object for which the links can be created, updated, and viewed.

Supported API: true.


setRole

public void setRole(String role)
Call this to set the role of the other side object. It is used to traverse the link that will be created, updated, or viewed.

Supported API: true.


getRole

public String getRole()
This is the getter of the role of the other side object.

Supported API: true.


getOtherSideClass

public Class getOtherSideClass()
This returns the class on the other side of the link.

Supported API: true.


setOtherSideClass

public void setOtherSideClass(Class other_side)
This sets the class on the other side of the link.

Supported API: true.


setOtherSideAttributes

public void setOtherSideAttributes(String[] attributes)
This sets the attributes on the other side object that will be displayed in the columns of the multilist.

Supported API: true.


getOtherSideAttributes

public String[] getOtherSideAttributes()
This returns an array of attributes on the other side object that are displayed in the columns of the multilist.

Supported API: true.


setLinkClassName

public void setLinkClassName(String class_name)
This is the public setter for the name of the link class to be displayed in the multilist and created, updated, or viewed.

Supported API: true.


getLinkClassName

public String getLinkClassName()
                        throws WTIntrospectionException,
                               WTException
This is the public getter for the name of the link class being displayed in the multilist and being created, updated, or viewed.

Supported API: true.

Throws:
WTIntrospectionException
WTException

getLinkClass

public Class getLinkClass()
                   throws WTIntrospectionException,
                          WTException,
                          ClassNotFoundException
This is the public getter for the link class being displayed in the multilist and being created, updated, or viewed.

Supported API: true.

Throws:
WTIntrospectionException
WTException
ClassNotFoundException

setModel

public void setModel(AssociationsModel model)
Set the model used to navigate the association

Supported API: true.


getModel

public AssociationsModel getModel()
Get the model used to navigate the association

Supported API: true.


setObjectClass

public void setObjectClass(Class object_class)
This is the public setter for the class to be displayed in the multilist and created, updated, or viewed.

Supported API: true.


getObjectClass

public Class getObjectClass()
This returns the Class for which the links are being displayed in the multilist.

Supported API: true.


getAttrValue

public String getAttrValue(Object obj,
                           Method getter)
                    throws InvocationTargetException,
                           IllegalAccessException
This invokes the getter on the object passed in and returns the string value representing that object.

Supported API: true.

Throws:
InvocationTargetException
IllegalAccessException

getAttrValue

public String getAttrValue(Object obj,
                           String attribute)
                    throws InvocationTargetException,
                           IllegalAccessException,
                           WTException
Throws:
InvocationTargetException
IllegalAccessException
WTException

getRelations

public Object getRelations()
                    throws WTIntrospectionException,
                           WTException,
                           ClassNotFoundException
This method navigates the links on the object and returns all links that are of the same class as the linkClass.

Supported API: true.

Throws:
WTIntrospectionException
WTException
ClassNotFoundException

getGetterMethod

public Method getGetterMethod(String attribute,
                              Object object)
                       throws WTException
This uses introspection to find the getter method for the object passed in and it's attribute.

Supported API: true.

Parameters:
attribute - for which to find the getter
object - that the getter is on
Throws:
WTException

save

public void save(Enumeration removed_links,
                 Hashtable links)
          throws WTException
This persists any new links that the user created, and any links that the user updated. It also removes the links that the user removed.

Supported API: true.

Throws:
WTException

createNewLink

protected BinaryLink createNewLink(Persistable added_object)
                            throws WTIntrospectionException,
                                   IllegalAccessException,
                                   NoSuchMethodException,
                                   InstantiationException,
                                   ClassNotFoundException,
                                   InvocationTargetException,
                                   WTException
This creates a new link between this side object and an added other-side object using the linkClass.

Supported API: true.

Throws:
WTIntrospectionException
IllegalAccessException
NoSuchMethodException
InstantiationException
ClassNotFoundException
InvocationTargetException
WTException

getSimpleName

protected String getSimpleName(Class a_class)
Helper method to get the name of the class without the package qualification.


getClassInfo

public ClassInfo getClassInfo()
                       throws WTException
This returns the ClassInfo for the current object whose links are being manipulated.

Supported API: true.

Throws:
WTException

initClassInfo

protected void initClassInfo()
                      throws WTException
This initializes the classInfo variable with a new instance of ClassInfo for the current objectClass

Supported API: true.

Throws:
WTException

isPersistent

public boolean isPersistent(Persistable persistable)
Tests to see if the Peristable parameter is persistent in the database.

Supported API: true.

Parameters:
persistable - A Peristable that will be tested to see if it is persistent.
Returns:
A boolean. The value true means that the Peristable parameter is persistent.
See Also:
Persistable

debug

private void debug(String message)

getStandardIcon

public Image getStandardIcon(WTObject myObject,
                             WTContext context)
Returns an Image that symbolically represents the object instance or class. For the WTQuery list, the Image should be 16x16 pixels. By convention, the background should be transparent which is readily supported by the GIF images. This method is used by WTQuery during run-time.

Supported API: true.

Returns:
Image to be displayed.
Since:
Windchill Foundation 1.0: WTQuery
See Also:
Image

initIconCache

private void initIconCache()

getDisplayName

public String getDisplayName(String attribute,
                             String class_name)
                      throws ClassNotFoundException,
                             WTIntrospectionException
This uses introspection to find the display name for the passed in attribute and the passed in class_name.

Supported API: true.

Throws:
ClassNotFoundException
WTIntrospectionException