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;
}
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;
}
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;
}
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();
}
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;
}
Aggregations