Changes for page Your First Rest Project

Last modified by Steve Peery on 2013/09/06 11:02

From version 39.1
edited by Pascal Robert
on 2012/12/12 08:01
Change comment: There is no comment for this version
To version 44.1
edited by skcodes
on 2013/05/13 12:53
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.probert
1 +XWiki.skcodes
Content
... ... @@ -94,7 +94,7 @@
94 94  
95 95  If you check in the **Outline** tab, you should see that **Author** now have a **blogEntries** relationship, and **BlogEntry** have a **author** relationship.
96 96  
97 -You are now ready to save the model. Save it (File > Save) and close the **Entity Modeler** window. If you open the **Sources** in the main Eclipse window, you will notice that the **Sources** folder contains a package named **your.app.model**.
97 +You are now ready to save the model. Save it (File > Save) and close the **Entity Modeler** window. If you open the **Sources** in the main Eclipse window, you will notice that the **Sources** folder contains a package named **your.app.model**. (If this folder doesn't appear, you may need to set your preferences to automatically generate these source files; see the second suggestion on http:~/~/wiki.wocommunity.org/display/documentation/Useful+Eclipse+or+WOLips+Preferences.)
98 98  
99 99  That package have four Java classes: **Author**, **Author**, **BlogEntry** and **BlogEntry**. Those classes were generated by Veogen, a templating engine build on Velocity. The two classes that starts with a underscore are recreated every time you change the EOModel, so if you want to change something in those classes, you need to change the template (no need for that right now). But you can change freely the two classes that don't have the underscore, and this is what we will be doing.
100 100  
... ... @@ -112,15 +112,17 @@
112 112  
113 113  {{code}}
114 114  
115 -@Override
115 + @Override
116 116   public void awakeFromInsertion(EOEditingContext editingContext) {
117 - super.awakeFromInsertion(editingContext);
118 - this.setCreationDate(new NSTimestamp());
117 + super.awakeFromInsertion(editingContext);
118 + NSTimestamp now = new NSTimestamp();
119 + setCreationDate(now);
120 + setLastModified(now);
119 119   }
120 120  
121 121  {{/code}}
122 122  
123 -Why are we adding this? **awakeFromInsertion** is a very good way of setting default values when creating a new instance of a Enterprise Object (EO). In this case, we want to set automatically the creation date without having the user to add that value.
125 +Why are we adding this? **awakeFromInsertion** is a very good way of setting default values when creating a new instance of a Enterprise Object (EO). In this case, we want to set automatically the creation and last modification dates without having the user to add those values.
124 124  
125 125  Now, let's use migrations to actually create the database.
126 126