public class CompactInstanceWrapper extends java.lang.Object implements WrappingStorageUtility.SerializationWrapper
Modifier and Type | Class and Description |
---|---|
private class |
CompactInstanceWrapper.ExtWrapAnswerData
ExternalizableWrapper to handle writing out a node's data.
|
Modifier and Type | Field and Description |
---|---|
static int |
CHOICE_INDEX |
static int |
CHOICE_MODE |
static int |
CHOICE_VALUE |
private FormInstance |
instance |
private InstanceTemplateManager |
templateMgr |
Constructor and Description |
---|
CompactInstanceWrapper() |
CompactInstanceWrapper(InstanceTemplateManager templateMgr) |
Modifier and Type | Method and Description |
---|---|
java.lang.Class |
baseType()
return type of underlying object
|
static java.lang.Class |
classForDataType(int dataType)
map xforms data types to the Class that represents that data in a FormInstance
|
void |
clean() |
private java.util.List<java.lang.Object> |
compactSelectMulti(SelectMultiData data)
reduce a SelectMultiData to a list of integers (index mode) or strings (value mode)
|
private java.lang.Object |
compactSelectOne(SelectOneData data)
reduce a SelectOneData to an integer (index mode) or string (value mode)
|
private java.lang.Object |
extractSelection(Selection s)
extract the value out of a Selection according to the current CHOICE_MODE
|
Externalizable |
getData()
retrieve the underlying object (to be followed by a call to readExternal)
|
private SelectMultiData |
getSelectMulti(java.util.List<java.lang.Object> v)
create a SelectMultiData from a list of integers (index mode) or strings (value mode)
|
private SelectOneData |
getSelectOne(java.lang.Object o)
create a SelectOneData from an integer (index mode) or string (value mode)
|
private FormInstance |
getTemplateInstance(int formID) |
static FormInstance |
loadTemplateInstance(int formID)
load a template instance fresh from the original FormDef, retrieved from RMS
|
private Selection |
makeSelection(java.lang.Object o)
build a Selection from an integer or string, according to the current CHOICE_MODE
|
void |
readExternal(java.io.DataInputStream in,
PrototypeFactory pf)
deserialize a compact instance.
|
private void |
readTreeElement(TreeElement e,
java.io.DataInputStream in,
PrototypeFactory pf)
recursively read in a node of the instance, by filling out the template instance
|
void |
setData(Externalizable e)
set the underlying object (to be followed by a call to writeExternal)
|
void |
writeExternal(java.io.DataOutputStream out)
serialize a compact instance
|
private void |
writeTreeElement(java.io.DataOutputStream out,
TreeElement e)
recursively write out a node of the instance
|
public static final int CHOICE_VALUE
public static final int CHOICE_INDEX
public static final int CHOICE_MODE
private InstanceTemplateManager templateMgr
private FormInstance instance
public CompactInstanceWrapper()
public CompactInstanceWrapper(InstanceTemplateManager templateMgr)
templateMgr
- template provider; if null, template is always fetched on-demand from RMS (slow!)public java.lang.Class baseType()
WrappingStorageUtility.SerializationWrapper
baseType
in interface WrappingStorageUtility.SerializationWrapper
public void setData(Externalizable e)
WrappingStorageUtility.SerializationWrapper
setData
in interface WrappingStorageUtility.SerializationWrapper
public Externalizable getData()
WrappingStorageUtility.SerializationWrapper
getData
in interface WrappingStorageUtility.SerializationWrapper
public void readExternal(java.io.DataInputStream in, PrototypeFactory pf) throws java.io.IOException, DeserializationException
readExternal
in interface Externalizable
java.io.IOException
DeserializationException
public void writeExternal(java.io.DataOutputStream out) throws java.io.IOException
writeExternal
in interface Externalizable
java.io.IOException
private FormInstance getTemplateInstance(int formID)
public static FormInstance loadTemplateInstance(int formID)
formID
- private void readTreeElement(TreeElement e, java.io.DataInputStream in, PrototypeFactory pf) throws java.io.IOException, DeserializationException
e
- ref
- in
- pf
- java.io.IOException
DeserializationException
private void writeTreeElement(java.io.DataOutputStream out, TreeElement e) throws java.io.IOException
out
- e
- ref
- java.io.IOException
private java.lang.Object compactSelectOne(SelectOneData data)
data
- private java.util.List<java.lang.Object> compactSelectMulti(SelectMultiData data)
data
- private SelectOneData getSelectOne(java.lang.Object o)
private SelectMultiData getSelectMulti(java.util.List<java.lang.Object> v)
private java.lang.Object extractSelection(Selection s)
s
- private Selection makeSelection(java.lang.Object o)
o
- public void clean()
clean
in interface WrappingStorageUtility.SerializationWrapper
public static java.lang.Class classForDataType(int dataType)
dataType
-