use of fi.otavanopisto.pyramus.domainmodel.accommodation.RoomType in project pyramus by otavanopisto.
the class RoomTypeDAO method create.
public RoomType create(String name) {
RoomType roomType = new RoomType();
roomType.setName(name);
return persist(roomType);
}
use of fi.otavanopisto.pyramus.domainmodel.accommodation.RoomType in project pyramus by otavanopisto.
the class CourseStudentDetailsDialogViewController method process.
public void process(PageRequestContext pageRequestContext) {
CourseStudentDAO courseStudentDAO = DAOFactory.getInstance().getCourseStudentDAO();
RoomTypeDAO roomTypeDAO = DAOFactory.getInstance().getRoomTypeDAO();
RoomDAO roomDAO = DAOFactory.getInstance().getRoomDAO();
Long courseStudentId = pageRequestContext.getLong("courseStudentId");
if (courseStudentId == null) {
throw new SmvcRuntimeException(PyramusStatusCode.UNDEFINED, "Missing courseStudentId parameter");
}
CourseStudent courseStudent = courseStudentDAO.findById(courseStudentId);
if (courseStudent == null) {
throw new SmvcRuntimeException(PyramusStatusCode.UNDEFINED, "Invalid courseStudentId parameter");
}
Map<RoomType, List<Room>> rooms = new TreeMap<>(new Comparator<RoomType>() {
@Override
public int compare(RoomType o1, RoomType o2) {
return o1.getName().compareTo(o2.getName());
}
});
List<RoomType> roomTypes = roomTypeDAO.listAll();
for (RoomType roomType : roomTypes) {
List<Room> typeRooms = roomDAO.listByType(roomType);
rooms.put(roomType, typeRooms);
}
// Support other currencies
List<Currency> currencies = Arrays.asList(Currency.getInstance("EUR"));
List<BillingDetails> existingBillingDetails = getExistingBillingDetails(courseStudent);
pageRequestContext.getRequest().setAttribute("courseStudent", courseStudent);
pageRequestContext.getRequest().setAttribute("rooms", rooms);
pageRequestContext.getRequest().setAttribute("currencies", currencies);
pageRequestContext.getRequest().setAttribute("existingBillingDetails", existingBillingDetails);
pageRequestContext.setIncludeJSP("/templates/courses/studentdetailsdialog.jsp");
}
Aggregations