Revision: 8098
Author: amitman...@google.com
Date: Tue May 11 17:08:18 2010
Log: Schema changes: added 'department' key to Report, changed the field name 'date' to 'created' in Expense. Made other necessary method name changes to follow the
pattern. Added some error handling to SampleDataPopulator

Review by: rj...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=8098

Modified:
 /branches/2.1/bikeshed/scripts/expensesJsonData.txt
/branches/2.1/bikeshed/src/com/google/gwt/requestfactory/server/SampleDataPopulator.java /branches/2.1/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ReportRecord.java /branches/2.1/bikeshed/src/com/google/gwt/sample/expenses/server/DataGenerator.java /branches/2.1/bikeshed/src/com/google/gwt/sample/expenses/server/domain/Report.java

=======================================
--- /branches/2.1/bikeshed/scripts/expensesJsonData.txt Mon May 10 19:50:25 2010 +++ /branches/2.1/bikeshed/scripts/expensesJsonData.txt Tue May 11 17:08:18 2010
@@ -2,6176 +2,5272 @@
     {"EmployeeRecord": {
         "id": "1",
         "department": "Marketing",
-        "userName": "coutstanding",
-        "displayName": "Catherine Outstanding"
+        "userName": "jawesome",
+        "displayName": "John Awesome"
     }},
     {"ReportRecord": {
         "id": "2",
-        "created": 1273155487285,
+        "created": 1270158940643,
         "reporterKey": 1,
-        "purpose": "Money laundering",
-        "notes": "Please bill to the Widgets project"
+        "department": "Marketing",
+        "purpose": "Spending lots of money",
+        "notes": "High priority"
     }},
     {"ExpenseRecord": {
-        "amount": 153.54,
+        "amount": 27.51,
         "id": "3",
-        "category": "Office Supplies",
-        "description": "Paste",
-        "date": 1267712952288
+        "category": "Local Transportation",
+        "created": 1267741470646,
+        "description": "Bus ticket"
     }},
     {"ExpenseRecord": {
-        "amount": 209.82,
+        "amount": 224.5,
         "id": "4",
         "category": "Dining",
-        "description": "Lunch",
-        "date": 1273048168288
+        "created": 1268194980646,
+        "description": "Lunch"
     }},
     {"ExpenseRecord": {
-        "amount": 238.86,
+        "amount": 0.97,
         "id": "5",
-        "category": "Office Supplies",
-        "description": "Scissors",
-        "date": 1272313798288
-    }},
-    {"ExpenseRecord": {
-        "amount": 223.03,
-        "id": "6",
-        "category": "Office Supplies",
-        "description": "Paperclips",
-        "date": 1272752883288
+        "category": "Local Transportation",
+        "created": 1271959835646,
+        "description": "Train fare"
     }},
     {"ReportRecord": {
-        "id": "7",
-        "created": 1269048644288,
+        "id": "6",
+        "created": 1270606338646,
         "reporterKey": 1,
-        "purpose": "Potato chip cooking offsite",
-        "notes": "High priority"
+        "department": "Marketing",
+        "purpose": "Visit to Istanbul",
+        "notes": "Need approval by Monday"
     }},
     {"ExpenseRecord": {
-        "amount": 247.03,
-        "id": "8",
+        "amount": 31.65,
+        "id": "7",
         "category": "Dining",
-        "description": "Breakfast",
-        "date": 1271265795288
+        "created": 1267447426646,
+        "description": "Dinner"
     }},
     {"ExpenseRecord": {
-        "amount": 174.06,
-        "id": "9",
-        "category": "Office Supplies",
-        "description": "Paperclips",
-        "date": 1266290089288
+        "amount": 59.01,
+        "id": "8",
+        "category": "Local Transportation",
+        "created": 1272708151646,
+        "description": "Bus ticket"
     }},
     {"ReportRecord": {
-        "id": "10",
-        "created": 1265990542288,
+        "id": "9",
+        "created": 1273335119646,
         "reporterKey": 1,
+        "department": "Marketing",
         "purpose": "Spending lots of money",
-        "notes": "Show me the money"
+        "notes": ""
     }},
     {"ExpenseRecord": {
-        "amount": 117.38,
+        "amount": 74.41,
+        "id": "10",
+        "category": "Lodging",
+        "created": 1267889638646,
+        "description": "Bed & Breakfast"
+    }},
+    {"ReportRecord": {
         "id": "11",
-        "category": "Local Transportation",
-        "description": "Train fare",
-        "date": 1271017410288
+        "created": 1271034778646,
+        "reporterKey": 1,
+        "department": "Marketing",
+        "purpose": "Sushi offsite",
+        "notes": "Show me the money"
     }},
     {"ExpenseRecord": {
-        "amount": 84.16,
+        "amount": 157.66,
         "id": "12",
-        "category": "Office Supplies",
-        "description": "Scissors",
-        "date": 1266069619288
+        "category": "Lodging",
+        "created": 1270713890646,
+        "description": "Bed & Breakfast"
     }},
     {"ExpenseRecord": {
-        "amount": 4.88,
+        "amount": 46.23,
         "id": "13",
-        "category": "Lodging",
-        "description": "Bed & Breakfast",
-        "date": 1266088033288
+        "category": "Dining",
+        "created": 1268489021646,
+        "description": "Lunch"
     }},
-    {"ExpenseRecord": {
-        "amount": 166.46,
+    {"EmployeeRecord": {
         "id": "14",
-        "category": "Local Transportation",
-        "description": "Bus ticket",
-        "date": 1270816358288
+        "department": "Marketing",
+        "userName": "ckrazy",
+        "displayName": "Catherine Krazy"
     }},
     {"ReportRecord": {
         "id": "15",
-        "created": 1272993938288,
-        "reporterKey": 1,
-        "purpose": "Sushi offsite",
-        "notes": "Need approval by Monday"
+        "created": 1268381657646,
+        "reporterKey": 14,
+        "department": "Marketing",
+        "purpose": "Potato chip cooking offsite",
+        "notes": "High priority"
     }},
     {"ExpenseRecord": {
-        "amount": 124.43,
+        "amount": 75.53,
         "id": "16",
-        "category": "Office Supplies",
-        "description": "Paperclips",
-        "date": 1272296648288
+        "category": "Dining",
+        "created": 1269916613646,
+        "description": "Lunch"
     }},
-    {"ReportRecord": {
+    {"ExpenseRecord": {
+        "amount": 13.59,
         "id": "17",
-        "created": 1267783191288,
-        "reporterKey": 1,
-        "purpose": "Spending lots of money",
-        "notes": "Review A.S.A.P."
+        "category": "Dining",
+        "created": 1270889381646,
+        "description": "Dinner"
     }},
     {"ExpenseRecord": {
-        "amount": 144.36,
+        "amount": 206.12,
         "id": "18",
         "category": "Local Transportation",
-        "description": "Train fare",
-        "date": 1267049425288
+        "created": 1267342622646,
+        "description": "Bus ticket"
     }},
     {"ExpenseRecord": {
-        "amount": 181.43,
+        "amount": 29.54,
         "id": "19",
-        "category": "Local Transportation",
-        "description": "Taxi fare",
-        "date": 1265901567288
+        "category": "Dining",
+        "created": 1269566225646,
+        "description": "Lunch"
     }},
-    {"ReportRecord": {
+    {"ExpenseRecord": {
+        "amount": 14.44,
         "id": "20",
-        "created": 1270148493288,
-        "reporterKey": 1,
-        "purpose": "Donut day",
-        "notes": "High priority"
+        "category": "Office Supplies",
+        "created": 1270216391646,
+        "description": "Scissors"
     }},
-    {"ExpenseRecord": {
-        "amount": 91.11,
+    {"ReportRecord": {
         "id": "21",
-        "category": "Dining",
-        "description": "Dinner",
-        "date": 1268673605288
+        "created": 1269050159646,
+        "reporterKey": 14,
+        "department": "Marketing",
+        "purpose": "Visit to Istanbul",
+        "notes": ""
     }},
     {"ExpenseRecord": {
-        "amount": 135.04,
+        "amount": 192.13,
         "id": "22",
-        "category": "Office Supplies",
-        "description": "Paste",
-        "date": 1271833572288
+        "category": "Dining",
+        "created": 1268631608646,
+        "description": "Dinner"
     }},
     {"ExpenseRecord": {
-        "amount": 154.53,
+        "amount": 101.53,
         "id": "23",
-        "category": "Air Travel",
-        "description": "Flight from ATL to SFO",
-        "date": 1270131091288
+        "category": "Dining",
+        "created": 1269628915646,
+        "description": "Dinner"
     }},
-    {"ExpenseRecord": {
-        "amount": 146.25,
+    {"ReportRecord": {
         "id": "24",
-        "category": "Air Travel",
-        "description": "Flight from SFO to ATL",
-        "date": 1269835424288
+        "created": 1268943791646,
+        "reporterKey": 14,
+        "department": "Marketing",
+        "purpose": "Potato chip cooking offsite",
+        "notes": "Review A.S.A.P."
     }},
     {"ExpenseRecord": {
-        "amount": 202.24,
+        "amount": 100.4,
         "id": "25",
         "category": "Office Supplies",
-        "description": "Paste",
-        "date": 1268041830288
+        "created": 1271852212646,
+        "description": "Paste"
     }},
-    {"ReportRecord": {
+    {"ExpenseRecord": {
+        "amount": 159.14,
         "id": "26",
-        "created": 1269132062288,
-        "reporterKey": 1,
-        "purpose": "Money laundering",
-        "notes": "Show me the money"
+        "category": "Office Supplies",
+        "created": 1269683167646,
+        "description": "Scissors"
     }},
     {"ExpenseRecord": {
-        "amount": 160.44,
+        "amount": 115.32,
         "id": "27",
-        "category": "Dining",
-        "description": "Dinner",
-        "date": 1271810455288
+        "category": "Local Transportation",
+        "created": 1272133370646,
+        "description": "Taxi fare"
     }},
-    {"ExpenseRecord": {
-        "amount": 226.56,
+    {"ReportRecord": {
         "id": "28",
-        "category": "Local Transportation",
-        "description": "Train fare",
-        "date": 1267641494288
+        "created": 1267860081646,
+        "reporterKey": 14,
+        "department": "Marketing",
+        "purpose": "Visit to Istanbul",
+        "notes": "Need approval by Monday"
     }},
     {"ExpenseRecord": {
-        "amount": 162.96,
+        "amount": 141.55,
         "id": "29",
-        "category": "Office Supplies",
-        "description": "Paste",
-        "date": 1271446377288
+        "category": "Air Travel",
+        "created": 1265993796646,
+        "description": "Flight from SFO to ATL"
     }},
     {"ExpenseRecord": {
-        "amount": 176.22,
+        "amount": 73.53,
         "id": "30",
-        "category": "Dining",
-        "description": "Dinner",
-        "date": 1269071480288
+        "category": "Local Transportation",
+        "created": 1269192186646,
+        "description": "Train fare"
     }},
     {"ExpenseRecord": {
-        "amount": 88.61,
+        "amount": 125.65,
         "id": "31",
-        "category": "Office Supplies",
-        "description": "Scissors",
-        "date": 1273319423288
+        "category": "Air Travel",
+        "created": 1272450812646,
+        "description": "Flight from SFO to ATL"
     }},
-    {"ReportRecord": {
+    {"ExpenseRecord": {
+        "amount": 145.65,
         "id": "32",
-        "created": 1270866207288,
-        "reporterKey": 1,
-        "purpose": "Visit to Istanbul",
-        "notes": "High priority"
+        "category": "Air Travel",
+        "created": 1271526656646,
+        "description": "Flight from ATL to SFO"
     }},
-    {"ExpenseRecord": {
-        "amount": 43.87,
+    {"ReportRecord": {
         "id": "33",
-        "category": "Lodging",
-        "description": "Hotel",
-        "date": 1266671626288
+        "created": 1273118505646,
+        "reporterKey": 14,
+        "department": "Marketing",
+        "purpose": "Donut day",
+        "notes": "Need approval by Monday"
     }},
     {"ExpenseRecord": {
-        "amount": 162.57,
+        "amount": 156.04,
         "id": "34",
-        "category": "Lodging",
-        "description": "Hotel",
-        "date": 1271650648288
+        "category": "Office Supplies",
+        "created": 1271046410646,
+        "description": "Paste"
     }},
-    {"ReportRecord": {
+    {"ExpenseRecord": {
+        "amount": 69.15,
         "id": "35",
-        "created": 1270436667288,
-        "reporterKey": 1,
-        "purpose": "ISDN modem for telecommuting",
-        "notes": "Please bill to the Widgets project"
+        "category": "Air Travel",
+        "created": 1269588752646,
+        "description": "Flight from ATL to SFO"
     }},
     {"ExpenseRecord": {
-        "amount": 70.54,
+        "amount": 73.6,
         "id": "36",
-        "category": "Air Travel",
-        "description": "Flight from SFO to ATL",
-        "date": 1269279995288
+        "category": "Office Supplies",
+        "created": 1267480472646,
+        "description": "Paperclips"
     }},
-    {"ExpenseRecord": {
-        "amount": 110.52,
+    {"ReportRecord": {
         "id": "37",
-        "category": "Lodging",
-        "description": "Hotel",
-        "date": 1272901765288
+        "created": 1269268619646,
+        "reporterKey": 14,
+        "department": "Marketing",
+        "purpose": "ISDN modem for telecommuting",
+        "notes": "Please bill to the Widgets project"
     }},
     {"ExpenseRecord": {
-        "amount": 192.1,
+        "amount": 117.9,
         "id": "38",
-        "category": "Office Supplies",
-        "description": "Stapler",
-        "date": 1271473537288
+        "category": "Lodging",
+        "created": 1270500917646,
+        "description": "Hotel"
     }},
     {"ExpenseRecord": {
-        "amount": 41.01,
+        "amount": 171.56,
         "id": "39",
-        "category": "Local Transportation",
-        "description": "Taxi fare",
-        "date": 1266162510288
+        "category": "Dining",
+        "created": 1267230516646,
+        "description": "Lunch"
     }},
-    {"ReportRecord": {
+    {"ExpenseRecord": {
+        "amount": 188.98,
         "id": "40",
-        "created": 1270255529288,
-        "reporterKey": 1,
-        "purpose": "Donut day",
-        "notes": "Review A.S.A.P."
+        "category": "Air Travel",
+        "created": 1272020184646,
+        "description": "Flight from ATL to SFO"
     }},
     {"ExpenseRecord": {
-        "amount": 34.98,
+        "amount": 161.14,
         "id": "41",
-        "category": "Lodging",
-        "description": "Bed & Breakfast",
-        "date": 1271462544288
+        "category": "Dining",
+        "created": 1270208291646,
+        "description": "Breakfast"
     }},
-    {"ExpenseRecord": {
-        "amount": 57.09,
+    {"ReportRecord": {
         "id": "42",
-        "category": "Office Supplies",
-        "description": "Stapler",
-        "date": 1268735512288
+        "created": 1271374106646,
+        "reporterKey": 14,
+        "department": "Marketing",
+        "purpose": "ISDN modem for telecommuting",
+        "notes": "Need approval by Monday"
     }},
     {"ExpenseRecord": {
-        "amount": 210.96,
+        "amount": 92.76,
         "id": "43",
-        "category": "Office Supplies",
-        "description": "Paste",
-        "date": 1265813997288
+        "category": "Local Transportation",
+        "created": 1269527159646,
+        "description": "Taxi fare"
     }},
     {"ExpenseRecord": {
-        "amount": 73.92,
+        "amount": 30.61,
         "id": "44",
         "category": "Office Supplies",
-        "description": "Paperclips",
-        "date": 1267105034288
+        "created": 1268841071646,
+        "description": "Scissors"
     }},
     {"ExpenseRecord": {
-        "amount": 64.45,
+        "amount": 69.63,
         "id": "45",
-        "category": "Dining",
-        "description": "Breakfast",
-        "date": 1272722979288
+        "category": "Local Transportation",
+        "created": 1269731477646,
+        "description": "Bus ticket"
     }},
-    {"ReportRecord": {
+    {"ExpenseRecord": {
+        "amount": 99.6,
         "id": "46",
-        "created": 1270524310288,
-        "reporterKey": 1,
-        "purpose": "Baseball card research",
-        "notes": "Need approval by Monday"
+        "category": "Office Supplies",
+        "created": 1265974764646,
+        "description": "Stapler"
     }},
     {"ExpenseRecord": {
-        "amount": 198.95,
+        "amount": 75.47,
         "id": "47",
         "category": "Lodging",
-        "description": "Hotel",
-        "date": 1271423851288
+        "created": 1266066983646,
+        "description": "Hotel"
     }},
-    {"ExpenseRecord": {
-        "amount": 131.47,
+    {"EmployeeRecord": {
         "id": "48",
-        "category": "Lodging",
-        "description": "Hotel",
-        "date": 1272492703288
+        "department": "Marketing",
+        "userName": "dradical",
+        "displayName": "Dave Radical"
     }},
-    {"ExpenseRecord": {
-        "amount": 161.45,
+    {"ReportRecord": {
         "id": "49",
-        "category": "Office Supplies",
-        "description": "Scissors",
-        "date": 1265797932288
+        "created": 1271084453646,
+        "reporterKey": 48,
+        "department": "Marketing",
+        "purpose": "Visit to Istanbul",
+        "notes": "Please bill to the Widgets project"
     }},
     {"ExpenseRecord": {
-        "amount": 239.26,
+        "amount": 157.45,
         "id": "50",
         "category": "Dining",
-        "description": "Lunch",
-        "date": 1269623850289
+        "created": 1269050872646,
+        "description": "Breakfast"
     }},
-    {"ReportRecord": {
+    {"ExpenseRecord": {
+        "amount": 92.08,
         "id": "51",
-        "created": 1269722536289,
-        "reporterKey": 1,
-        "purpose": "Visit to Istanbul",
-        "notes": ""
+        "category": "Local Transportation",
+        "created": 1266235016646,
+        "description": "Taxi fare"
     }},
-    {"ExpenseRecord": {
-        "amount": 101.18,
+    {"ReportRecord": {
         "id": "52",
-        "category": "Air Travel",
-        "description": "Flight from ATL to SFO",
-        "date": 1270419932289
+        "created": 1269701271646,
+        "reporterKey": 48,
+        "department": "Marketing",
+        "purpose": "ISDN modem for telecommuting",
+        "notes": ""
     }},
     {"ExpenseRecord": {
-        "amount": 42.72,
+        "amount": 29.44,
         "id": "53",
-        "category": "Lodging",
-        "description": "Hotel",
-        "date": 1266685768289
+        "category": "Dining",
+        "created": 1272597192646,
+        "description": "Breakfast"
     }},
-    {"EmployeeRecord": {
+    {"ExpenseRecord": {
+        "amount": 197.27,
         "id": "54",
-        "department": "Engineering",
-        "userName": "aperfect",
-        "displayName": "Amy Perfect"
+        "category": "Office Supplies",
+        "created": 1266080226646,
+        "description": "Stapler"
     }},
-    {"ReportRecord": {
+    {"ExpenseRecord": {
+        "amount": 62.24,
         "id": "55",
-        "created": 1271560156289,
-        "reporterKey": 54,
-        "purpose": "Sushi offsite",
-        "notes": ""
+        "category": "Air Travel",
+        "created": 1272333829646,
+        "description": "Flight from SFO to ATL"
     }},
     {"ExpenseRecord": {
-        "amount": 74.62,
+        "amount": 212.4,
         "id": "56",
-        "category": "Air Travel",
-        "description": "Flight from SFO to ATL",
-        "date": 1270965244289
+        "category": "Dining",
+        "created": 1267259989646,
+        "description": "Dinner"
     }},
-    {"ExpenseRecord": {
-        "amount": 102.22,
+    {"ReportRecord": {
         "id": "57",
-        "category": "Office Supplies",
-        "description": "Stapler",
-        "date": 1270085707289
+        "created": 1267663448646,
+        "reporterKey": 48,
+        "department": "Marketing",
+        "purpose": "Potato chip cooking offsite",
+        "notes": "Show me the money"
     }},
-    {"ReportRecord": {
+    {"ExpenseRecord": {
+        "amount": 183.17,
         "id": "58",
-        "created": 1266313723289,
-        "reporterKey": 54,
-        "purpose": "Money laundering",
-        "notes": "Need approval by Monday"
+        "category": "Local Transportation",
+        "created": 1267862167646,
+        "description": "Bus ticket"
     }},
     {"ExpenseRecord": {
-        "amount": 101.99,
+        "amount": 187.14,
         "id": "59",
         "category": "Office Supplies",
-        "description": "Scissors",
-        "date": 1272619457289
+        "created": 1269576565646,
+        "description": "Scissors"
     }},
-    {"ReportRecord": {
+    {"ExpenseRecord": {
+        "amount": 45.28,
         "id": "60",
-        "created": 1272923573289,
-        "reporterKey": 54,
-        "purpose": "Team building diamond cutting offsite",
-        "notes": "Review A.S.A.P."
+        "category": "Local Transportation",
+        "created": 1269662483646,
+        "description": "Train fare"
     }},
-    {"ExpenseRecord": {
-        "amount": 87.46,
+    {"ReportRecord": {
         "id": "61",
-        "category": "Office Supplies",
-        "description": "Paste",
-        "date": 1272445852289
+        "created": 1271666169646,
+        "reporterKey": 48,
+        "department": "Marketing",
+        "purpose": "Sushi offsite",
+        "notes": "Show me the money"
     }},
     {"ExpenseRecord": {
-        "amount": 26.37,
+        "amount": 244.71,
         "id": "62",
-        "category": "Dining",
-        "description": "Dinner",
-        "date": 1269345405289
+        "category": "Lodging",
+        "created": 1266309376646,
+        "description": "Hotel"
     }},
-    {"ExpenseRecord": {
-        "amount": 9.12,
+    {"ReportRecord": {
         "id": "63",
-        "category": "Air Travel",
-        "description": "Flight from ATL to SFO",
-        "date": 1268289861289
+        "created": 1271110292646,
+        "reporterKey": 48,
+        "department": "Marketing",
+        "purpose": "Baseball card research",
+        "notes": "Need approval by Monday"
     }},
-    {"ReportRecord": {
+    {"ExpenseRecord": {
+        "amount": 173.12,
         "id": "64",
-        "created": 1270126326289,
-        "reporterKey": 54,
-        "purpose": "Potato chip cooking offsite",
-        "notes": "Review A.S.A.P."
+        "category": "Dining",
+        "created": 1266401680646,
+        "description": "Dinner"
     }},
     {"ExpenseRecord": {
-        "amount": 189.19,
+        "amount": 6.83,
         "id": "65",
-        "category": "Dining",
-        "description": "Lunch",
-        "date": 1273473779289
+        "category": "Office Supplies",
+        "created": 1269523103646,
+        "description": "Scissors"
     }},
     {"ExpenseRecord": {
-        "amount": 86.93,
+        "amount": 84.43,
         "id": "66",
-        "category": "Dining",
-        "description": "Breakfast",
-        "date": 1267228009289
+        "category": "Local Transportation",
+        "created": 1270503090646,
+        "description": "Bus ticket"
     }},
-    {"ReportRecord": {
+    {"ExpenseRecord": {
+        "amount": 21.75,
         "id": "67",
-        "created": 1271369005289,
-        "reporterKey": 54,
-        "purpose": "Money laundering",
-        "notes": ""
+        "category": "Lodging",
+        "created": 1268622238646,
+        "description": "Hotel"
     }},
-    {"ExpenseRecord": {
-        "amount": 214.59,
+    {"ReportRecord": {
         "id": "68",
-        "category": "Local Transportation",
-        "description": "Taxi fare",
-        "date": 1268174015289
+        "created": 1270154197646,
+        "reporterKey": 48,
+        "department": "Marketing",
+        "purpose": "Donut day",
+        "notes": "Show me the money"
     }},
     {"ExpenseRecord": {
-        "amount": 100.87,
+        "amount": 168.18,
         "id": "69",
-        "category": "Office Supplies",
-        "description": "Paste",
-        "date": 1265847562289
+        "category": "Local Transportation",
+        "created": 1270243978646,
+        "description": "Taxi fare"
     }},
     {"ReportRecord": {
         "id": "70",
-        "created": 1269163048289,
-        "reporterKey": 54,
+        "created": 1268103072646,
+        "reporterKey": 48,
+        "department": "Marketing",
         "purpose": "ISDN modem for telecommuting",
         "notes": "High priority"
     }},
     {"ExpenseRecord": {
-        "amount": 240.31,
+        "amount": 243.8,
         "id": "71",
-        "category": "Office Supplies",
-        "description": "Scissors",
-        "date": 1268690056289
+        "category": "Dining",
+        "created": 1270492849646,
+        "description": "Dinner"
     }},
     {"ExpenseRecord": {
-        "amount": 122.78,
+        "amount": 38.47,
         "id": "72",
-        "category": "Office Supplies",
-        "description": "Paste",
-        "date": 1271112088289
+        "category": "Dining",
+        "created": 1269769936646,
+        "description": "Dinner"
     }},
     {"ExpenseRecord": {
-        "amount": 59.59,
+        "amount": 200.33,
         "id": "73",
-        "category": "Office Supplies",
-        "description": "Paste",
-        "date": 1268796373289
+        "category": "Dining",
+        "created": 1268868296646,
+        "description": "Dinner"
     }},
     {"ExpenseRecord": {
-        "amount": 6.93,
+        "amount": 210.47,
         "id": "74",
-        "category": "Local Transportation",
-        "description": "Train fare",
-        "date": 1267595102289
+        "category": "Air Travel",
+        "created": 1268400135646,
+        "description": "Flight from SFO to ATL"
     }},
     {"ExpenseRecord": {
-        "amount": 19.15,
+        "amount": 157.73,
         "id": "75",
-        "category": "Lodging",
-        "description": "Hotel",
-        "date": 1265929460289
+        "category": "Dining",
+        "created": 1267508158646,
+        "description": "Lunch"
     }},
     {"ReportRecord": {
         "id": "76",
-        "created": 1268804358289,
-        "reporterKey": 54,
-        "purpose": "Sushi offsite",
-        "notes": "Review A.S.A.P."
+        "created": 1268712948646,
+        "reporterKey": 48,
+        "department": "Marketing",
+        "purpose": "Money laundering",
+        "notes": "Please bill to the Widgets project"
     }},
     {"ExpenseRecord": {
-        "amount": 137.08,
+        "amount": 76.87,
         "id": "77",
-        "category": "Air Travel",
-        "description": "Flight from SFO to ATL",
-        "date": 1272102557289
+        "category": "Office Supplies",
+        "created": 1266032334646,
+        "description": "Scissors"
     }},
-    {"ReportRecord": {
+    {"ExpenseRecord": {
+        "amount": 94.51,
         "id": "78",
-        "created": 1266823428289,
-        "reporterKey": 54,
-        "purpose": "Donut day",
-        "notes": "Need approval by Monday"
+        "category": "Office Supplies",
+        "created": 1268128030646,
+        "description": "Paperclips"
     }},
     {"ExpenseRecord": {
-        "amount": 185.25,
+        "amount": 19.5,
         "id": "79",
         "category": "Office Supplies",
-        "description": "Scissors",
-        "date": 1270999583289
+        "created": 1270820735646,
+        "description": "Scissors"
     }},
     {"ExpenseRecord": {
-        "amount": 128.91,
+        "amount": 161.98,
         "id": "80",
         "category": "Dining",
-        "description": "Lunch",
-        "date": 1268631188289
-    }},
-    {"ExpenseRecord": {
-        "amount": 38.4,
-        "id": "81",
-        "category": "Dining",
-        "description": "Dinner",
-        "date": 1271289894289
+        "created": 1266725490646,
+        "description": "Lunch"
     }},
     {"ReportRecord": {
-        "id": "82",
-        "created": 1272016830289,
-        "reporterKey": 54,
-        "purpose": "Sushi offsite",
+        "id": "81",
+        "created": 1272376326646,
+        "reporterKey": 48,
+        "department": "Marketing",
+        "purpose": "Team building diamond cutting offsite",
         "notes": "Show me the money"
     }},
     {"ExpenseRecord": {
-        "amount": 100.38,
-        "id": "83",
+        "amount": 174.55,
+        "id": "82",
         "category": "Office Supplies",
-        "description": "Stapler",
-        "date": 1272099183289
+        "created": 1269428112647,
+        "description": "Stapler"
     }},
     {"ExpenseRecord": {
-        "amount": 20.46,
+        "amount": 198.24,
+        "id": "83",
+        "category": "Lodging",
+        "created": 1266833731647,
+        "description": "Bed & Breakfast"
+    }},
+    {"ReportRecord": {
         "id": "84",
-        "category": "Local Transportation",
-        "description": "Train fare",
-        "date": 1267899067289
+        "created": 1270134705647,
+        "reporterKey": 48,
+        "department": "Marketing",
+        "purpose": "Baseball card research",
+        "notes": "Need approval by Monday"
     }},
     {"ExpenseRecord": {
-        "amount": 125.7,
+        "amount": 107.94,
         "id": "85",
         "category": "Office Supplies",
-        "description": "Scissors",
-        "date": 1267064489289
+        "created": 1270178814647,
+        "description": "Paste"
     }},
     {"ExpenseRecord": {
-        "amount": 67.43,
+        "amount": 244.16,
         "id": "86",
-        "category": "Local Transportation",
-        "description": "Taxi fare",
-        "date": 1266097892289
-    }},
-    {"ExpenseRecord": {
-        "amount": 42.88,
-        "id": "87",
         "category": "Office Supplies",
-        "description": "Paste",
-        "date": 1271711484289
+        "created": 1270031713647,
+        "description": "Scissors"
     }},
     {"ReportRecord": {
-        "id": "88",
-        "created": 1270366008289,
-        "reporterKey": 54,
-        "purpose": "Donut day",
+        "id": "87",
+        "created": 1267563206647,
+        "reporterKey": 48,
+        "department": "Marketing",
***The diff for this file has been truncated for email.***
=======================================
--- /branches/2.1/bikeshed/src/com/google/gwt/requestfactory/server/SampleDataPopulator.java Mon May 10 19:50:25 2010 +++ /branches/2.1/bikeshed/src/com/google/gwt/requestfactory/server/SampleDataPopulator.java Tue May 11 17:08:18 2010
@@ -17,10 +17,13 @@

 import com.google.gwt.dev.util.Util;
 import com.google.gwt.requestfactory.shared.RequestFactory;
+import com.google.gwt.requestfactory.shared.RequestFactory.WriteOperation;

 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpStatus;
 import org.apache.commons.httpclient.methods.PostMethod;
+import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;

@@ -32,13 +35,27 @@
  */
 public class SampleDataPopulator {

- public static void main(String args[]) throws HttpException, JSONException, IOException { + public static void main(String args[]) throws HttpException, JSONException,
+      IOException {
+    // TODO: cleanup argument processing and error reporting.
     if (args.length < 2) {
-      System.err.println("Require two arguments: URL string and fileName");
+      printHelp();
       System.exit(-1);
     }
- SampleDataPopulator populator = new SampleDataPopulator(args[0], args[1]);
-    populator.populate();
+    try {
+ SampleDataPopulator populator = new SampleDataPopulator(args[0], args[1]);
+      populator.populate();
+    } catch (Exception ex) {
+      ex.printStackTrace();
+      printHelp();
+    }
+  }
+
+  private static void printHelp() {
+    StringBuffer sb = new StringBuffer();
+    sb.append("\n");
+ sb.append("Requires two arguments: the URL to post the JSON data and the path to the JSON data file.");
+    System.err.println(sb.toString());
   }

   private final String url;
@@ -64,12 +81,15 @@
     post.setRequestBody(request.toString());
     HttpClient client = new HttpClient();
     int status = client.executeMethod(post);
-    String response = post.getResponseBodyAsString();
-    if (status == 200) {
-      System.out.println("SUCCESS: Put all the records in the datastore!");
-    } else {
-      System.err.println("Error: Status code " + status + " returned");
-    }
+    JSONObject response = new JSONObject(post.getResponseBodyAsString());
+ JSONArray records = response.getJSONArray(WriteOperation.CREATE.name());
+    if (status == HttpStatus.SC_OK) {
+      System.out.println("SUCCESS: Put " + records.length()
+          + " records in the datastore!");
+      return;
+    }
+    System.err.println("POST failed: Status line " + post.getStatusLine()
+        + ", please check your URL");
   }

   private JSONObject readAsJsonObject(String string) throws JSONException {
=======================================
--- /branches/2.1/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ReportRecord.java Tue May 4 15:09:04 2010 +++ /branches/2.1/bikeshed/src/com/google/gwt/sample/expenses/gwt/request/ReportRecord.java Tue May 11 17:08:18 2010
@@ -39,6 +39,7 @@
Property<String> approvedSupervisorKey = new Property<String>("approvedSupervisorKey",
       String.class);
   Property<Date> created = new Property<Date>("created", Date.class);
+ Property<String> department = new Property<String>("department", String.class);
   Property<String> notes = new Property<String>("notes", String.class);
   Property<String> purpose = new Property<String>("purpose", String.class);
   Property<String> reporterKey = new Property<String>("reporterKey",
@@ -47,7 +48,9 @@
   String getApprovedSupervisorKey();

   Date getCreated();
-
+
+  String getDepartment();
+
   String getNotes();

   String getPurpose();
=======================================
--- /branches/2.1/bikeshed/src/com/google/gwt/sample/expenses/server/DataGenerator.java Tue May 11 10:56:00 2010 +++ /branches/2.1/bikeshed/src/com/google/gwt/sample/expenses/server/DataGenerator.java Tue May 11 17:08:18 2010
@@ -113,11 +113,12 @@
     String username = (firstName.charAt(0) + lastName).toLowerCase();
     abc.setUserName(username);
     abc.setDisplayName(firstName + " " + lastName);
-    abc.setDepartment(nextValue(DEPARTMENTS));
+    String department = nextValue(DEPARTMENTS);
+    abc.setDepartment(department);
     abc.setId(id++);
     objectList.add(abc);

-    addReports(abc.getId());
+    addReports(abc.getId(), department);
   }

   private void addExpenses(Long reportId) {
@@ -142,12 +143,13 @@
    *
    * @param employeeId the id of the employee who created the report
    */
-  private void addReports(Long employeeId) {
+  private void addReports(Long employeeId, String department) {
     // Add 1-20 expense reports.
     int reportCount = 1 + rand.nextInt(20);
     for (int i = 0; i < reportCount; i++) {
       Report report = new Report();
       report.setCreated(getDate());
+      report.setDepartment(department);
       report.setReporterKey(employeeId);
       report.setPurpose(nextValue(PURPOSES));
       report.setNotes(nextValue(NOTES));
@@ -178,7 +180,7 @@
     JSONObject jsonObject = new JSONObject();
     jsonObject.put("id", "" + expense.getId());
     jsonObject.put("description", expense.getDescription());
-    jsonObject.put("date", expense.getCreated().getTime());
+    jsonObject.put("created", expense.getCreated().getTime());
     jsonObject.put("amount", expense.getAmount());
     jsonObject.put("category", expense.getCategory());
     return jsonObject;
@@ -208,6 +210,7 @@
     JSONObject jsonObject = new JSONObject();
     jsonObject.put("id", "" + report.getId());
     jsonObject.put("created", report.getCreated().getTime());
+    jsonObject.put("department", report.getDepartment());
     jsonObject.put("reporterKey", report.getReporterKey());
     jsonObject.put("purpose", report.getPurpose());
     jsonObject.put("notes", report.getNotes());
=======================================
--- /branches/2.1/bikeshed/src/com/google/gwt/sample/expenses/server/domain/Report.java Tue May 4 08:08:32 2010 +++ /branches/2.1/bikeshed/src/com/google/gwt/sample/expenses/server/domain/Report.java Tue May 11 17:08:18 2010
@@ -185,7 +185,9 @@
   private Integer version;

   private Date created;
-
+
+  private String department;
+
   private String notes;

   private String purpose;
@@ -214,6 +216,10 @@
   public Date getCreated() {
     return this.created;
   }
+
+  public String getDepartment() {
+    return this.department;
+  }

   public Long getId() {
     return this.id;
@@ -261,6 +267,10 @@
   public void setCreated(Date created) {
     this.created = created;
   }
+
+  public void setDepartment(String department) {
+    this.department = department;
+  }

   public void setId(Long id) {
     this.id = id;
@@ -288,6 +298,7 @@
     sb.append("Id: ").append(getId()).append(", ");
     sb.append("Version: ").append(getVersion()).append(", ");
     sb.append("Created: ").append(getCreated()).append(", ");
+    sb.append("Department: ").append(getDepartment()).append(", ");
     sb.append("Notes: ").append(getNotes()).append(", ");
     sb.append("Purpose: ").append(getPurpose()).append(", ");
     sb.append("Reporter: ").append(getReporterKey()).append(", ");

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to