Advertisement
Guest User

Untitled

a guest
Dec 12th, 2012
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. DWR SERVICE:
  2. public List<AppointmentBlockDetails> getAppointmentBlocks(Date fromDate, Date toDate, Integer locationId) {
  3. List<AppointmentBlock> appointmentBlockList = new ArrayList<AppointmentBlock>();
  4. List<AppointmentBlockDetails> appointmentBlockDetails = new Vector<AppointmentBlockDetails>();
  5. if (Context.isAuthenticated()) {
  6. AppointmentService appointmentService = Context.getService(AppointmentService.class);
  7. Location location = null;
  8. if (locationId != null)
  9. location = Context.getLocationService().getLocation(locationId);
  10. appointmentBlockList = appointmentService.getAppointmentBlocks(fromDate, toDate, location);
  11. for (AppointmentBlock appointmentBlock : appointmentBlockList) {
  12. Set<AppointmentType> appointmentTypes = appointmentBlock.getTypes();
  13. String appointmentTypeNames = "";
  14. int appointmentTypeSize = appointmentTypes.size();
  15. for (AppointmentType appointmentType : appointmentTypes) {
  16. appointmentTypeNames += appointmentType.getName();
  17. //if it is not the last type, append ","
  18. if (appointmentTypeSize > 1)
  19. appointmentTypeNames += ", ";
  20. appointmentTypeSize--;
  21. }
  22. appointmentBlockDetails.add(new AppointmentBlockDetails(appointmentBlock.getId() + "", appointmentBlock
  23. .getLocation().getName(), appointmentBlock.getProvider().getName(), appointmentTypeNames,
  24. appointmentBlock.getStartDate().toString(), appointmentBlock.getEndDate().toString()));
  25. }
  26. }
  27. return appointmentBlockDetails;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement