Changes for page Your First Rest Project

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

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

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.skcodes
1 +XWiki.probert
Content
... ... @@ -75,7 +75,6 @@
75 75  |= Attribute name |= Column |= Prototype
76 76  | content | content | longtext
77 77  | creationDate | creationDate | dateTime
78 -| lastModified | lastModified | dateTime
79 79  
80 80  If you did everything well, the list of attributes should look like this:
81 81  
... ... @@ -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**. (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.)
96 +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**.
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,17 +112,15 @@
112 112  
113 113  {{code}}
114 114  
115 - @Override
114 +@Override
116 116   public void awakeFromInsertion(EOEditingContext editingContext) {
117 - super.awakeFromInsertion(editingContext);
118 - NSTimestamp now = new NSTimestamp();
119 - setCreationDate(now);
120 - setLastModified(now);
116 + super.awakeFromInsertion(editingContext);
117 + this.setCreationDate(new NSTimestamp());
121 121   }
122 122  
123 123  {{/code}}
124 124  
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.
122 +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.
126 126  
127 127  Now, let's use migrations to actually create the database.
128 128