Search in sources :

Example 6 with RequestMapping

use of org.springframework.web.bind.annotation.RequestMapping in project spring-boot-admin by codecentric.

the class RegistryController method register.

/**
	 * Register an application within this admin application.
	 *
	 * @param application The application infos.
	 * @return The registered application.
	 */
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<Application> register(@RequestBody Application application) {
    Application applicationWithSource = Application.copyOf(application).withSource("http-api").build();
    LOGGER.debug("Register application {}", applicationWithSource.toString());
    Application registeredApp = registry.register(applicationWithSource);
    return ResponseEntity.status(HttpStatus.CREATED).body(registeredApp);
}
Also used : Application(de.codecentric.boot.admin.model.Application) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 7 with RequestMapping

use of org.springframework.web.bind.annotation.RequestMapping in project spring-boot-admin by codecentric.

the class RegistryController method unregister.

/**
	 * Unregister an application within this admin application.
	 *
	 * @param id The application id.
	 * @return the unregistered application.
	 */
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public ResponseEntity<?> unregister(@PathVariable String id) {
    LOGGER.debug("Unregister application with ID '{}'", id);
    Application application = registry.deregister(id);
    if (application != null) {
        return ResponseEntity.ok(application);
    } else {
        return ResponseEntity.notFound().build();
    }
}
Also used : Application(de.codecentric.boot.admin.model.Application) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with RequestMapping

use of org.springframework.web.bind.annotation.RequestMapping in project spring-boot-admin by codecentric.

the class JournalController method getJournalEvents.

@RequestMapping(produces = "text/event-stream")
public SseEmitter getJournalEvents() {
    final SseEmitter emitter = new SseEmitter();
    emitter.onCompletion(new Runnable() {

        @Override
        public void run() {
            emitters.remove(emitter);
        }
    });
    emitters.add(emitter);
    return emitter;
}
Also used : SseEmitter(org.springframework.web.servlet.mvc.method.annotation.SseEmitter) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 9 with RequestMapping

use of org.springframework.web.bind.annotation.RequestMapping in project head by mifos.

the class AccountingDataController method confirmExportsDelete.

@RequestMapping("confirmExportsDelete.ftl")
public final ModelAndView confirmExportsDelete() {
    ModelAndView mav = new ModelAndView("confirmExportsDelete");
    List<BreadCrumbsLinks> breadcrumbs = new AdminBreadcrumbBuilder().withLink("accounting.viewaccountingexports", "confirmExportsDelete.ftl").build();
    mav.addObject("breadcrumbs", breadcrumbs);
    return mav;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) BreadCrumbsLinks(org.mifos.ui.core.controller.BreadCrumbsLinks) AdminBreadcrumbBuilder(org.mifos.ui.core.controller.AdminBreadcrumbBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 10 with RequestMapping

use of org.springframework.web.bind.annotation.RequestMapping in project head by mifos.

the class AccountingDataController method showAccountingDataFor.

@RequestMapping("renderAccountingData.ftl")
public final ModelAndView showAccountingDataFor(@RequestParam(value = FROM_DATE) String paramFromDate, @RequestParam(value = TO_DATE) String paramToDate) {
    DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd");
    LocalDate fromDate = fmt.parseDateTime(paramFromDate).toLocalDate();
    LocalDate toDate = fmt.parseDateTime(paramToDate).toLocalDate();
    Boolean hasAlreadyRanQuery = Boolean.FALSE;
    String fileName = null;
    List<AccountingDto> accountingData = new ArrayList<AccountingDto>();
    try {
        fileName = accountingService.getExportOutputFileName(fromDate, toDate).replace(".xml", "");
        hasAlreadyRanQuery = accountingService.hasAlreadyRanQuery(fromDate, toDate);
        accountingData = accountingService.getExportDetails(fromDate, toDate);
    } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
    }
    ModelAndView mav = new ModelAndView("renderAccountingData");
    List<BreadCrumbsLinks> breadcrumbs = new AdminBreadcrumbBuilder().withLink("accounting.viewaccountingexports", "renderAccountingDataCacheInfo.ftl").withLink(fileName, "").build();
    mav.addObject("breadcrumbs", breadcrumbs);
    mav.addObject("accountingData", accountingData);
    mav.addObject("hasAlreadyRanQuery", hasAlreadyRanQuery);
    mav.addObject("fileName", fileName);
    mav.addObject("fromDate", fromDate);
    mav.addObject("toDate", toDate);
    return mav;
}
Also used : ArrayList(java.util.ArrayList) ModelAndView(org.springframework.web.servlet.ModelAndView) BreadCrumbsLinks(org.mifos.ui.core.controller.BreadCrumbsLinks) AccountingDto(org.mifos.platform.accounting.AccountingDto) DateTimeFormatter(org.joda.time.format.DateTimeFormatter) LocalDate(org.joda.time.LocalDate) AdminBreadcrumbBuilder(org.mifos.ui.core.controller.AdminBreadcrumbBuilder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1622 ModelAndView (org.springframework.web.servlet.ModelAndView)401 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)375 ArrayList (java.util.ArrayList)177 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)175 HashMap (java.util.HashMap)147 WebMessageException (org.hisp.dhis.dxf2.webmessage.WebMessageException)124 IOException (java.io.IOException)83 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)75 Date (java.util.Date)73 ApiOperation (io.swagger.annotations.ApiOperation)68 User (org.hisp.dhis.user.User)59 HttpServletResponse (javax.servlet.http.HttpServletResponse)56 ResponseEntity (org.springframework.http.ResponseEntity)56 InputStream (java.io.InputStream)53 OrganisationUnit (org.hisp.dhis.organisationunit.OrganisationUnit)51 Locale (java.util.Locale)50 CommandStringBuilder (org.apache.geode.management.internal.cli.util.CommandStringBuilder)47 DBObject (com.mongodb.DBObject)46 Aggregation (org.springframework.data.mongodb.core.aggregation.Aggregation)45