tailieunhanh - Bắt đầu với IBM Websphere smash - p 21

182 Chapter 8 Database Access Table RESTful Verbs Overridden Method onList() onRetrieve() onCreate() onUpdate() onPutCollection() onDelete() Sample URL /resources/bookmark /resources/bookmark/123 /resources/bookmark /resources/bookmark/123 /resources/bookmark /resources/bookmark/123 REST Verb GET (Collection) GET (Singleton) POST (Singleton) PUT (Singleton) PUT (Collection) DELETE (Singleton) By using the ZRM delegate, you can potentially save yourself hundreds of lines of boilerplate code per resource. That’s a huge savings in terms of development time and maintenance costs. ZRM is the best junior developer your team has ever had, without all that clowning around. Adding Data to a Zero Resource Model A database-backed resource without data is like a circus without dancing poodles—not much to look at | 182 Chapter 8 Database Access Table RESTful Verbs REST Verb Overridden Method Sample URL GET Collection onList resources bookmark GET Singleton onRetrieve resources bookmark 123 POST Singleton onCreate resources bookmark PUT Singleton onUpdate resources bookmark 123 PUT Collection onPutCollection resources bookmark DELETE Singleton onDelete resources bookmark 123 By using the ZRM delegate you can potentially save yourself hundreds of lines of boilerplate code per resource. That s a huge savings in terms of development time and maintenance costs. ZRM is the best junior developer your team has ever had without all that clowning around. Adding Data to a Zero Resource Model A database-backed resource without data is like a circus without dancing poodles not much to look at. Let s fix that situation by adding data records to our bookmark table. This can be done in a couple different ways. If you have a large block of data to load it s best to format it into a special fixed format used by WebSphere sMash and bulk load it into the table. Alternately you can use the predefined sample page to manually add records one by one. Obviously this is not an ideal solution if there is a lot of data to load so spend the effort to swizzle your data and perform the bulk load. Most databases also provide a native means to bulk load data into tables as well but that s not within the spirit of sMashing things so let s create a sample loader file instead. To perform a bulk data load you need to create a JSON data file in the app model fixtures directory of the project. In AppBuilder with the project open select New File Other File. In the dialog box type the full filename of app models fixtures and click Create. You may use any filename you want but keeps things obvious. The structure of the load file allows for defining data for multiple tables at once as set by the type value. An empty editor will be displayed where you can paste in your JSON-formatted

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.