RSF CRUD Tool Exercise

Information

The RSF CRUD tool is generated by the Sakai App Builder and provides a simple CRUD (Create, Read, Update, Delete) tool in RSF to get developers started writing Sakai apps quickly.

The CRUD tool

  • Consists of 2 screens (main and add/edit)
  • Allows a user to create items which are shared or private
  • Uses Sakai Authz permissions to control access to items
  • Uses the recommended Sakai application (tool) structure

Exercises

Add a page (part 1)

  • Summary page (shows statistics on the total entries, admin only)
  • Add additional page which is accessible from the list page
  • add new template
  • add new producer
  • add producer to requestContext
  • modify list template
  • modify list producer
    • test at this point

Add a page (part 2)

  • make this actually work
  • modify logic api
  • modify logic test
  • modify logic impl
  • update the summary producer (don't use security by obscurity)
  • update list producer

Add a permission

  • New permission (view summary page)
  • Update the logic api
  • update the logic test
  • Update the logic impl

Add a field to the data model

  • Description
  • textarea
  • text in hbm file
  • update the model class file
    • show hibernate tools?
  • update the logic test
  • update the dao test
  • update dao preload
  • update the AddItem template
  • update the AddItem producer
  • update the backing bean
    • check with antranig about overriding the "null return" in RSF

Use announcement service

  • Create announcement when new visible items are added
    • use this code
      String channelRef = announcementService.channelReference(siteId, SiteService.MAIN_CONTAINER);
      try {
      	AnnouncementChannel ac = announcementService.getAnnouncementChannel(channelRef);
      	ac.addAnnouncementMessage("New Item", false, null, "A new item was added called: title");
      } catch (IdUnusedException e1) {
      	log.error("failure adding message: ref=" + channelRef,e1);
      } catch (PermissionException e1) {
      	log.error("failure adding message: ref=" + channelRef,e1);
      }
      
  • Update the logic api
  • update the logic test
  • Update the logic impl
  • Update the backing bean

Advanced exercise (if extra time)

  • Notes page (allows user to store or remove notes with any item)
  • update the item HBM (add collection, non-lazy)
  • update add item template
  • update add item producer
  • update the backing bean