Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * The contents of this file are subject to the OpenMRS Public License
- * Version 1.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://license.openmrs.org
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
- * License for the specific language governing rights and limitations
- * under the License.
- *
- * Copyright (C) OpenMRS, LLC. All Rights Reserved.
- */
- package org.openmrs.web.controller.encounter;
- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.List;
- import org.openmrs.Location;
- import org.openmrs.LocationTag;
- import org.openmrs.api.context.Context;
- import org.openmrs.propertyeditor.LocationTagEditor;
- import org.openmrs.util.MetadataComparator;
- import org.openmrs.validator.LocationTagValidator;
- import org.openmrs.web.WebConstants;
- import org.springframework.stereotype.Controller;
- import org.springframework.ui.ModelMap;
- import org.springframework.util.StringUtils;
- import org.springframework.validation.BindingResult;
- import org.springframework.web.bind.WebDataBinder;
- import org.springframework.web.bind.annotation.InitBinder;
- import org.springframework.web.bind.annotation.ModelAttribute;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.SessionAttributes;
- import org.springframework.web.bind.support.SessionStatus;
- import org.springframework.web.context.request.WebRequest;
- /**
- * Controller for managing {@link Orders}s
- */
- @Controller
- public class OrderController {
- /**
- * Set up automatic primitive-to-class mappings
- *
- * @param wdb
- */
- @InitBinder
- public void initBinder(WebDataBinder wdb) {
- wdb.registerCustomEditor(Order.class, new OrderEditor());
- }
- /**
- * List all Orders
- */
- @RequestMapping("/order")
- public void list(ModelMap model) {
- List<Order> list = new ArrayList<Order>(Context.getOrderService().getOrderables());
- Collections.sort(list, new MetadataComparator(Context.getLocale()));
- model.addAttribute("orders", list);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment