|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sandev.TaskHeap.TaskHeapUI.DemoDataSetup
Helper class to populate or remove demo data. The demo data is assumed to be created at startup, and then reset on demand at any point after that. The data consists of a tutorial, which looks something like:
In order to allow for recreating the data in exactly as initially specified, with the same structure, we track the data via the uniqueID and reset it to how it is initially defined here. So this works a lot like initial data verification.
| Field Summary | |
protected org.sandev.basics.structs.SandPersistMessage[] |
demoData
The instances that comprise our data. |
protected static java.lang.String |
newline
When writing text information we need to store the encoded newline character for it to show up. |
protected static java.lang.String |
para
A new paragraph is two newlines chained together. |
| Constructor Summary | |
DemoDataSetup()
|
|
| Method Summary | |
org.sandev.basics.structs.SandPersistMessage[] |
getDemoData()
initializing accessor for demoData |
protected org.sandev.basics.structs.SandPersistMessage |
hardGetInstance(TaskHeapUINode uinode,
java.lang.String classname,
long id,
org.sandev.basics.util.AuthUser user)
Retrieve the specified instance from the database, regardless of whatever its recordStatus currently is. |
protected void |
initDemoData()
Set up our demoData for query, add or delete operations. |
void |
setDemoData(org.sandev.basics.structs.SandPersistMessage[] spms)
mutator for demoData |
void |
verifyDemoData(TaskHeapUINode uinode,
org.sandev.basics.util.AuthUser user)
Verify the defined demo data exists. |
protected void |
verifyParentReference(org.sandev.basics.structs.SandPersistMessage msg,
TaskHeapUINode uinode,
org.sandev.basics.util.AuthUser user)
Verify that the parent of the given message references this message as a child. |
protected void |
writeMessage(org.sandev.basics.structs.SandPersistMessage msg,
boolean addNew,
TaskHeapUINode uinode,
org.sandev.basics.util.AuthUser user)
Write the given message to the database. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final java.lang.String newline
When doing the translation for display on a windows box, the newlines don't show up unless you use a crlf. So to have the data look like what it looks like post editing, we do crlf here. This will presumably work on most systems, and makes sense in terms of consistency, since all our initial data was created this way.
protected static final java.lang.String para
protected org.sandev.basics.structs.SandPersistMessage[] demoData
| Constructor Detail |
public DemoDataSetup()
| Method Detail |
public org.sandev.basics.structs.SandPersistMessage[] getDemoData()
public void setDemoData(org.sandev.basics.structs.SandPersistMessage[] spms)
protected void initDemoData()
public void verifyDemoData(TaskHeapUINode uinode,
org.sandev.basics.util.AuthUser user)
throws org.sandev.basics.structs.SandException
This method assumes that the demo data is declared with the correct parent and child references.
org.sandev.basics.structs.SandException
protected void writeMessage(org.sandev.basics.structs.SandPersistMessage msg,
boolean addNew,
TaskHeapUINode uinode,
org.sandev.basics.util.AuthUser user)
throws org.sandev.basics.structs.SandException
For an add, we change the uniqueID to a temporary value, and then switch it back afterwards. We are relying on the fact that we populate demo data at startup to ensure that the IDs stay in sync.
org.sandev.basics.structs.SandException
protected void verifyParentReference(org.sandev.basics.structs.SandPersistMessage msg,
TaskHeapUINode uinode,
org.sandev.basics.util.AuthUser user)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandException
protected org.sandev.basics.structs.SandPersistMessage hardGetInstance(TaskHeapUINode uinode,
java.lang.String classname,
long id,
org.sandev.basics.util.AuthUser user)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||