package edu.jbs.ooc.databeans; import java.util.*; import java.io.*; /** * Insert the type's description here. * Creation date: (2/20/2002 8:55:14 AM) * @author: Administrator */ public class ObjectBean extends DataBean { /******************************** Superclass for ViewBean. ********************************/ private java.lang.String type; private int target; private java.util.Hashtable values; public final static int PERSON = 101; public final static int CONTENT = 102; public final static int FILE = 103; /** * ObjectBean constructor comment. */ public ObjectBean() { super(); values = new Hashtable(); } /** * Insert the method's description here. * Creation date: (3/8/2002 10:52:58 AM) * @param obj edu.jbs.ooc.databeans.ObjectBean */ public ObjectBean(ObjectBean obj) { super(); type = obj.getType(); target = obj.getTarget(); values = obj.getValues(); } /** * Insert the method's description here. * Creation date: (3/3/2002 11:09:57 AM) * @return java.util.Vector */ public java.util.Vector getFields() { return new Vector( values.keySet() ); } /** * Insert the method's description here. * Creation date: (3/11/2002 8:33:08 AM) * @return java.lang.String */ public int getTarget() { return target; } /** * Insert the method's description here. * Creation date: (2/20/2002 8:56:03 AM) * @return int */ public String getType() { return type; } /** * Insert the method's description here. * Creation date: (3/3/2002 4:44:59 PM) * @return java.lang.Object */ public Object getValue( String fieldName ) { if ( !(values.containsKey( fieldName )) ) return null; else return values.get( fieldName ); } /** * Insert the method's description here. * Creation date: (3/3/2002 11:10:56 AM) * @return java.util.Vector */ public java.util.Hashtable getValues() { return values; } /** * Insert the method's description here. * Creation date: (3/4/2002 9:21:15 AM) * @return java.lang.Object * @param fieldName java.lang.String */ public String getValueType(String fieldName) { Object fieldValue = getValue( fieldName ); String classString = ( (fieldValue.getClass()).toString() ).trim(); if ( classString.startsWith("class ") ) classString = classString.substring(6); return classString; } /** * Insert the method's description here. * Creation date: (3/3/2002 4:31:25 PM) * @return java.lang.String */ public boolean isField( String fieldName ) { return values.containsKey( fieldName ); } /** * Insert the method's description here. * Creation date: (3/11/2002 8:33:08 AM) * @param newTarget java.lang.String */ public void setTarget(int newTarget) { target = newTarget; } /** * Insert the method's description here. * Creation date: (2/20/2002 8:56:03 AM) * @param newType int */ public void setType(String newType) { type = newType; } /** * Insert the method's description here. * Creation date: (3/3/2002 4:44:59 PM) * @param newValue java.lang.Object */ public void setValue( String fieldName, Object newValue) { values.put( fieldName, newValue ); } /** * Insert the method's description here. * Creation date: (3/3/2002 11:10:56 AM) * @param newValues java.util.Vector */ public void setValues(java.util.Hashtable newValues) { Enumeration keys = newValues.keys(); while ( keys.hasMoreElements() ) { String currentKey = (String)keys.nextElement(); Object currentVal = newValues.get( currentKey ); setValue( currentKey, currentVal ); } } }