Search in sources :

Example 26 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project sic by belluccifranco.

the class GastoController method getGastosPorCajaYFormaDePago.

@GetMapping("/gastos/busqueda")
@ResponseStatus(HttpStatus.OK)
public List<Gasto> getGastosPorCajaYFormaDePago(@RequestParam long idEmpresa, @RequestParam long idFormaDePago, @RequestParam long desde, @RequestParam long hasta) {
    Date fechaDesde = new Date(desde);
    Date fechaHasta = new Date(hasta);
    return gastoService.getGastosEntreFechasYFormaDePago(idEmpresa, idFormaDePago, fechaDesde, fechaHasta);
}
Also used : Date(java.util.Date) GetMapping(org.springframework.web.bind.annotation.GetMapping) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus)

Example 27 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project dhis2-core by dhis2.

the class DataElementOperandController method getObjectList.

@GetMapping
@SuppressWarnings("unchecked")
@ResponseBody
public RootNode getObjectList(@RequestParam Map<String, String> rpParameters, OrderParams orderParams) throws QueryParserException {
    Schema schema = schemaService.getDynamicSchema(DataElementOperand.class);
    List<String> fields = Lists.newArrayList(contextService.getParameterValues("fields"));
    List<String> filters = Lists.newArrayList(contextService.getParameterValues("filter"));
    List<Order> orders = orderParams.getOrders(schema);
    if (fields.isEmpty()) {
        fields.addAll(Preset.ALL.getFields());
    }
    WebOptions options = new WebOptions(rpParameters);
    WebMetadata metadata = new WebMetadata();
    List<DataElementOperand> dataElementOperands;
    if (options.isTrue("persisted")) {
        dataElementOperands = Lists.newArrayList(manager.getAll(DataElementOperand.class));
    } else {
        boolean totals = options.isTrue("totals");
        String deg = CollectionUtils.popStartsWith(filters, "dataElement.dataElementGroups.id:eq:");
        deg = deg != null ? deg.substring("dataElement.dataElementGroups.id:eq:".length()) : null;
        String ds = options.get("dataSet");
        if (deg != null) {
            DataElementGroup dataElementGroup = manager.get(DataElementGroup.class, deg);
            dataElementOperands = dataElementCategoryService.getOperands(dataElementGroup.getMembers(), totals);
        } else if (ds != null) {
            DataSet dataSet = manager.get(DataSet.class, ds);
            dataElementOperands = dataElementCategoryService.getOperands(dataSet, totals);
        } else {
            List<DataElement> dataElements = new ArrayList<>(manager.getAllSorted(DataElement.class));
            dataElementOperands = dataElementCategoryService.getOperands(dataElements, totals);
        }
    }
    Query query = queryService.getQueryFromUrl(DataElementOperand.class, filters, orders, options.getRootJunction());
    query.setDefaultOrder();
    query.setObjects(dataElementOperands);
    dataElementOperands = (List<DataElementOperand>) queryService.query(query);
    Pager pager = metadata.getPager();
    if (options.hasPaging() && pager == null) {
        pager = new Pager(options.getPage(), dataElementOperands.size(), options.getPageSize());
        linkService.generatePagerLinks(pager, DataElementOperand.class);
        dataElementOperands = PagerUtils.pageCollection(dataElementOperands, pager);
    }
    RootNode rootNode = NodeUtils.createMetadata();
    if (pager != null) {
        rootNode.addChild(NodeUtils.createPager(pager));
    }
    rootNode.addChild(fieldFilterService.filter(DataElementOperand.class, dataElementOperands, fields));
    return rootNode;
}
Also used : Order(org.hisp.dhis.query.Order) DataElementOperand(org.hisp.dhis.dataelement.DataElementOperand) RootNode(org.hisp.dhis.node.types.RootNode) Query(org.hisp.dhis.query.Query) DataSet(org.hisp.dhis.dataset.DataSet) Schema(org.hisp.dhis.schema.Schema) WebOptions(org.hisp.dhis.webapi.webdomain.WebOptions) WebMetadata(org.hisp.dhis.webapi.webdomain.WebMetadata) Pager(org.hisp.dhis.common.Pager) DataElementGroup(org.hisp.dhis.dataelement.DataElementGroup) ArrayList(java.util.ArrayList) List(java.util.List) GetMapping(org.springframework.web.bind.annotation.GetMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 28 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project vft-capture by videofirst.

the class InfoController method info.

@GetMapping
public Info info() {
    Info info = infoService.getInfo();
    info.setCaptureStatus(captureService.status());
    info.setUploads(uploadService.status());
    return info;
}
Also used : Info(co.videofirst.vft.capture.model.info.Info) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 29 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project tesla by linking12.

the class FilterRuleController method edit.

@RequiresPermissions("filter:rule:edit")
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, Model model) {
    FilterRuleDO ruleDo = ruleService.get(id);
    model.addAttribute("rule", ruleDo);
    return prefix + "/edit";
}
Also used : FilterRuleDO(io.github.tesla.filter.domain.FilterRuleDO) RequiresPermissions(org.apache.shiro.authz.annotation.RequiresPermissions) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 30 with GetMapping

use of org.springframework.web.bind.annotation.GetMapping in project tesla by linking12.

the class LoginController method logout.

@GetMapping("/logout")
String logout() {
    Subject subject = SecurityUtils.getSubject();
    subject.logout();
    return "redirect:/login";
}
Also used : Subject(org.apache.shiro.subject.Subject) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

GetMapping (org.springframework.web.bind.annotation.GetMapping)737 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)114 ResponseEntity (org.springframework.http.ResponseEntity)78 ArrayList (java.util.ArrayList)52 ModelAndView (org.springframework.web.servlet.ModelAndView)48 List (java.util.List)46 WebMessageException (org.hisp.dhis.dxf2.webmessage.WebMessageException)45 HttpHeaders (org.springframework.http.HttpHeaders)40 HashMap (java.util.HashMap)38 lombok.val (lombok.val)38 Map (java.util.Map)37 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)36 Grid (org.hisp.dhis.common.Grid)35 IOException (java.io.IOException)32 ApiOperation (io.swagger.annotations.ApiOperation)31 RootNode (org.hisp.dhis.node.types.RootNode)31 RequestParam (org.springframework.web.bind.annotation.RequestParam)31 PathVariable (org.springframework.web.bind.annotation.PathVariable)30 HttpServletRequest (javax.servlet.http.HttpServletRequest)29 FieldFilterParams (org.hisp.dhis.fieldfilter.FieldFilterParams)28