Search in sources :

Example 26 with RequestMapping

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

the class ApprovalController method list.

@RequestMapping("restApprovalList.ftl")
public ModelAndView list() {
    ModelAndView mav = new ModelAndView("approval/list");
    List<BreadCrumbsLinks> breadcrumbs = new AdminBreadcrumbBuilder().withLink("View REST Approval List", "").build();
    mav.addObject("isApprovalRequired", RESTConfigKey.isApprovalRequired(configurationServiceFacade));
    mav.addObject("breadcrumbs", breadcrumbs);
    mav.addObject("waitingForApprovalList", approvalService.getAllWaiting());
    mav.addObject("approvedList", approvalService.getAllNotWaiting());
    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 27 with RequestMapping

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

the class ApprovalController method details.

@RequestMapping("restApproval/id-{id}/details.ftl")
public ModelAndView details(@PathVariable Long id) {
    ModelAndView mav = new ModelAndView("approval/details");
    mav.addObject("waitingForApprovalList", approvalService.getAllWaiting());
    RESTApprovalEntity approval = approvalService.getDetails(id);
    mav.addObject("approval", approval);
    PersonnelInformationDto p = personnelServiceFacade.getPersonnelInformationDto(approval.getCreatedBy().longValue(), null);
    mav.addObject("createdBy", p.getDisplayName());
    if (!approval.getState().equals(ApprovalState.WAITING)) {
        p = personnelServiceFacade.getPersonnelInformationDto(approval.getApprovedBy().longValue(), null);
        mav.addObject("approvedBy", p.getDisplayName());
    }
    return mav;
}
Also used : PersonnelInformationDto(org.mifos.dto.screen.PersonnelInformationDto) RESTApprovalEntity(org.mifos.rest.approval.domain.RESTApprovalEntity) ModelAndView(org.springframework.web.servlet.ModelAndView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 28 with RequestMapping

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

the class JSONAjaxController method deleteCacheDir.

@RequestMapping("jsonAjax.ftl")
public ModelAndView deleteCacheDir(HttpServletResponse response) {
    ModelAndView mav;
    if (TestMode.MAIN == testingService.getTestMode()) {
        response.setStatus(HttpServletResponse.SC_NOT_FOUND);
        mav = new ModelAndView("pageNotFound");
    } else {
        mav = new ModelAndView("jsonAjax");
    }
    return mav;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 29 with RequestMapping

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

the class AspectJRESTApprovalInterceptor method profile.

@Around("restMethods() && requestMapping() && excludeAPI() && exludeRestfulServices()")
public Object profile(ProceedingJoinPoint pjp) throws Throwable {
    Signature signature = pjp.getStaticPart().getSignature();
    LOG.debug(this.getClass().getSimpleName() + " staring");
    // FIXME : somehow autowiring is not working
    if (approvalService == null) {
        approvalService = ApplicationContextProvider.getBean(ApprovalService.class);
    }
    if (configurationServiceFacade == null) {
        configurationServiceFacade = ApplicationContextProvider.getBean(ConfigurationServiceFacade.class);
    }
    if (parameterNameDiscoverer == null) {
        parameterNameDiscoverer = ApplicationContextProvider.getBean(ParameterNameDiscoverer.class);
    }
    if (!RESTConfigKey.isApprovalRequired(configurationServiceFacade)) {
        LOG.debug(pjp.getSignature() + " skip approval");
        return pjp.proceed();
    }
    if (signature instanceof MethodSignature) {
        MethodSignature ms = (MethodSignature) signature;
        Method m = ms.getMethod();
        RequestMapping mapping = m.getAnnotation(RequestMapping.class);
        if (isReadOnly(mapping)) {
            LOG.debug(m.getName() + " is read only, hence returning control");
            return pjp.proceed();
        }
        Class<?> methodClassType = m.getDeclaringClass();
        if (!methodClassType.getSimpleName().endsWith("RESTController")) {
            LOG.debug(m.getName() + " is not from REST controller, hence returning control");
            return pjp.proceed();
        }
        Object[] argValues = pjp.getArgs();
        Class<?>[] argTypes = m.getParameterTypes();
        String methodName = m.getName();
        String[] names = parameterNameDiscoverer.getParameterNames(m);
        MethodArgHolder args = new MethodArgHolder(argTypes, argValues, names);
        ApprovalMethod method = new ApprovalMethod(methodName, methodClassType, args);
        approvalService.create(method);
    }
    return pjp.proceed();
}
Also used : MethodSignature(org.aspectj.lang.reflect.MethodSignature) ParameterNameDiscoverer(org.springframework.core.ParameterNameDiscoverer) ApprovalService(org.mifos.rest.approval.service.ApprovalService) RequestMethod(org.springframework.web.bind.annotation.RequestMethod) ApprovalMethod(org.mifos.rest.approval.domain.ApprovalMethod) Method(java.lang.reflect.Method) ConfigurationServiceFacade(org.mifos.config.servicefacade.ConfigurationServiceFacade) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) MethodArgHolder(org.mifos.rest.approval.domain.MethodArgHolder) Signature(org.aspectj.lang.Signature) MethodSignature(org.aspectj.lang.reflect.MethodSignature) ApprovalMethod(org.mifos.rest.approval.domain.ApprovalMethod) Around(org.aspectj.lang.annotation.Around)

Example 30 with RequestMapping

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

the class ApprovalRESTController method updateMethodData.

@RequestMapping(value = "id-{id}/methodData", method = RequestMethod.POST)
public ModelMap updateMethodData(@PathVariable(value = "id") Long id, @RequestBody ApprovalMethod content) throws Exception {
    ModelMap model = new ModelMap();
    approvalService.updateMethodContent(id, content);
    model.addAttribute("status", "success");
    return model;
}
Also used : ModelMap(org.springframework.ui.ModelMap) 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