Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DWR SERVICE:
- public List<AppointmentBlockDetails> getAppointmentBlocks(Date fromDate, Date toDate, Integer locationId) {
- List<AppointmentBlock> appointmentBlockList = new ArrayList<AppointmentBlock>();
- List<AppointmentBlockDetails> appointmentBlockDetails = new Vector<AppointmentBlockDetails>();
- if (Context.isAuthenticated()) {
- AppointmentService appointmentService = Context.getService(AppointmentService.class);
- Location location = null;
- if (locationId != null)
- location = Context.getLocationService().getLocation(locationId);
- appointmentBlockList = appointmentService.getAppointmentBlocks(fromDate, toDate, location);
- for (AppointmentBlock appointmentBlock : appointmentBlockList) {
- Set<AppointmentType> appointmentTypes = appointmentBlock.getTypes();
- String appointmentTypeNames = "";
- int appointmentTypeSize = appointmentTypes.size();
- for (AppointmentType appointmentType : appointmentTypes) {
- appointmentTypeNames += appointmentType.getName();
- //if it is not the last type, append ","
- if (appointmentTypeSize > 1)
- appointmentTypeNames += ", ";
- appointmentTypeSize--;
- }
- appointmentBlockDetails.add(new AppointmentBlockDetails(appointmentBlock.getId() + "", appointmentBlock
- .getLocation().getName(), appointmentBlock.getProvider().getName(), appointmentTypeNames,
- appointmentBlock.getStartDate().toString(), appointmentBlock.getEndDate().toString()));
- }
- }
- return appointmentBlockDetails;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement