com.waveset.object
Class ViewUtil

java.lang.Object
  extended bycom.waveset.object.ViewUtil

public class ViewUtil
extends java.lang.Object


Field Summary
static java.lang.String code_id
           
protected static Trace trace
           
 
Constructor Summary
ViewUtil()
           
 
Method Summary
static boolean compareValues(java.lang.Object v1, java.lang.Object v2)
          Compare two values for differences, handling null.
static void copy(java.util.Map src, java.util.Map dest, java.lang.String attname)
          Copy an attribute from one view to another if it is non-null.
static boolean getBoolean(java.lang.Object value)
          Coerce an object into a primitive boolean value.
static java.util.Date getDate(java.lang.Object value)
          Coerce an object into a date.
static EncryptedData getEncrypted(GenericObject obj, java.lang.String name)
          Coerce a view attribute into an encrypted string.
static EncryptedData getEncrypted(java.lang.Object value)
          Coerce an object into an encrypted string.
static Form getForm(LighthouseContext ctx, java.lang.String id)
          Read a form object stored in the repostiory.
static Form getForm(LighthouseContext ctx, java.lang.String id, Type baseType)
           
static Form getForm(LighthouseContext ctx, java.lang.String id, Type baseType, boolean checkSystemConfigOverrides)
           
static java.util.List getList(java.lang.Object value)
          Coerce an object into a list.
static java.lang.String getString(java.lang.Object value)
          Coerce an object into a string.
static void put(GenericObject view, java.lang.String attname, boolean value)
           
static void put(GenericObject view, java.lang.String attname, java.util.Date date)
           
static void put(GenericObject view, java.lang.String attname, EncryptedData value)
           
static void put(GenericObject view, java.lang.String attname, java.lang.String value)
          Assign a view attribute if it is non-null.
static void resolveIncludes(Form form, ObjectCache cache)
          Resolve directives in a form object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

trace

protected static final Trace trace
Constructor Detail

ViewUtil

public ViewUtil()
Method Detail

getForm

public static Form getForm(LighthouseContext ctx,
                           java.lang.String id)
                    throws WavesetException
Read a form object stored in the repostiory. We now support ids that are indexes into the System Configuration object.

Throws:
WavesetException

getForm

public static Form getForm(LighthouseContext ctx,
                           java.lang.String id,
                           Type baseType)
                    throws WavesetException
Throws:
WavesetException

getForm

public static Form getForm(LighthouseContext ctx,
                           java.lang.String id,
                           Type baseType,
                           boolean checkSystemConfigOverrides)
                    throws WavesetException
Throws:
WavesetException

resolveIncludes

public static void resolveIncludes(Form form,
                                   ObjectCache cache)
                            throws WavesetException
Resolve directives in a form object.

Though includes are represented as ObjectRefs, we resolve them in an unusual way. Since forms can be large, we normally return references directly into the server cache, rather than copying them out to every session cache. This means we have to be careful not to let ObjectRefs resolved within the server cache leak beyond the Session, as this will in effect let a handle to the server cache escape, mayhem ensues.

Further, we can avoid form authorization issues by resolving before the Form leaves the session. The user session does not have to have access to every Configuration object containing forms.

Finally, in a few odd cases like the login form and the login/change password form, we may not even have a session yet, so the application won't have a session cache to use to resolve references.

The cache is expected to be the server cache.

Throws:
WavesetException

compareValues

public static boolean compareValues(java.lang.Object v1,
                                    java.lang.Object v2)
Compare two values for differences, handling null. They are assumed to be of the correct type by now. NOTE: This is being used to compare old/new values of resource account attributes. If the values are both Lists, there may be cases where we want to treat ordering of the list as insignificant.


getString

public static java.lang.String getString(java.lang.Object value)
Coerce an object into a string. Doesn't do much, but its shorter and easier to read.


getEncrypted

public static EncryptedData getEncrypted(java.lang.Object value)
Coerce an object into an encrypted string.


getEncrypted

public static EncryptedData getEncrypted(GenericObject obj,
                                         java.lang.String name)
Coerce a view attribute into an encrypted string.


getDate

public static java.util.Date getDate(java.lang.Object value)
Coerce an object into a date.


getBoolean

public static boolean getBoolean(java.lang.Object value)
Coerce an object into a primitive boolean value.


getList

public static java.util.List getList(java.lang.Object value)
Coerce an object into a list. Will take a List, Object[] or Object.


put

public static void put(GenericObject view,
                       java.lang.String attname,
                       java.lang.String value)
                throws WavesetException
Assign a view attribute if it is non-null. Used to cut down on the size of the view if we have a lot of optional fields.

Throws:
WavesetException

put

public static void put(GenericObject view,
                       java.lang.String attname,
                       boolean value)
                throws WavesetException
Throws:
WavesetException

put

public static void put(GenericObject view,
                       java.lang.String attname,
                       EncryptedData value)
                throws WavesetException
Throws:
WavesetException

put

public static void put(GenericObject view,
                       java.lang.String attname,
                       java.util.Date date)
                throws WavesetException
Throws:
WavesetException

copy

public static void copy(java.util.Map src,
                        java.util.Map dest,
                        java.lang.String attname)
Copy an attribute from one view to another if it is non-null.