use of org.springframework.security.access.prepost.PreAuthorize in project head by mifos.
the class WebTierAccountServiceFacade method applyMemberAccountHistoricalAdjustment.
/**
* adjustment for member account payment has to be handled along with parent account payments and other members payments.
* This method prepares data and run applyHistoricalAdjustment so adjustment will be made for parent payment context.
*/
@Override
@PreAuthorize("isFullyAuthenticated()")
public void applyMemberAccountHistoricalAdjustment(String memberGlobalAccountNum, Integer memberPaymentId, String adjustmentNote, Short personnelId, AdjustedPaymentDto adjustedPaymentDto) {
try {
LoanBO memberAccount = (LoanBO) accountBusinessService.findBySystemId(memberGlobalAccountNum);
LoanBO parentAccount = memberAccount.getParentAccount();
if (parentAccount == null) {
throw new AccountException(LoanExceptionConstants.NO_PARENT_ACCOUNT_EXCEPTION);
}
AccountPaymentEntity parentPaymentEntity = memberAccount.findParentPaymentByMemberPaymentId(memberPaymentId);
List<AdjustedPaymentDto> membersAdjustedPaymentDtoList = new ArrayList<AdjustedPaymentDto>();
for (AccountPaymentEntity memberPayment : parentPaymentEntity.getMemberPayments()) {
if (memberPayment.getAccount().getAccountId().equals(memberAccount.getAccountId())) {
membersAdjustedPaymentDtoList.add(new AdjustedPaymentDto(adjustedPaymentDto.getAmount(), adjustedPaymentDto.getPaymentDate(), adjustedPaymentDto.getPaymentType(), memberAccount.getAccountId()));
} else {
membersAdjustedPaymentDtoList.add(new AdjustedPaymentDto(memberPayment.getAmount().getAmount().toString(), adjustedPaymentDto.getPaymentDate(), adjustedPaymentDto.getPaymentType(), memberPayment.getAccount().getAccountId()));
}
}
BigDecimal parentAmountSubstraction = memberAccount.findPaymentById(memberPaymentId).getAmount().getAmount().subtract((new BigDecimal(adjustedPaymentDto.getAmount())));
String newParentAmount = parentPaymentEntity.getAmount().getAmount().subtract(parentAmountSubstraction).toString();
AdjustedPaymentDto parentAdjustedPaymentDto = new AdjustedPaymentDto(newParentAmount, adjustedPaymentDto.getPaymentDate(), adjustedPaymentDto.getPaymentType(), parentAccount.getAccountId(), membersAdjustedPaymentDtoList);
this.applyHistoricalAdjustment(parentAccount.getGlobalAccountNum(), parentPaymentEntity.getPaymentId(), adjustmentNote, personnelId, parentAdjustedPaymentDto);
} catch (ServiceException e) {
throw new MifosRuntimeException(e);
} catch (AccountException e) {
throw new MifosRuntimeException(e);
}
}
use of org.springframework.security.access.prepost.PreAuthorize in project head by mifos.
the class PentahoReportsServiceImpl method getEtlLastUpdateDate.
@Override
@PreAuthorize("isFullyAuthenticated()")
public Date getEtlLastUpdateDate(HttpServletRequest request) {
ServletContext context = request.getSession().getServletContext();
Date lastSucessfulRunEtl = null;
try {
List<BatchjobsDto> batchjobs = batchjobsServiceFacade.getBatchjobs(context);
for (BatchjobsDto batchjob : batchjobs) {
if (batchjob.getName().equals("ETLReportDWTaskJob")) {
lastSucessfulRunEtl = batchjob.getLastSuccessfulRun();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return lastSucessfulRunEtl;
}
use of org.springframework.security.access.prepost.PreAuthorize in project pinpoint by naver.
the class LegacyAgentStatController method getAgentStatV1.
@Deprecated
@PreAuthorize("hasPermission(new com.navercorp.pinpoint.web.vo.AgentParam(#agentId, #to), 'agentParam', 'inspector')")
@RequestMapping(value = "/getAgentStat/v1", method = RequestMethod.GET)
@ResponseBody
public LegacyAgentStatChartGroup getAgentStatV1(@RequestParam("agentId") String agentId, @RequestParam("from") long from, @RequestParam("to") long to, @RequestParam(value = "sampleRate", required = false) Integer sampleRate) throws Exception {
StopWatch watch = new StopWatch();
watch.start("agentStatService.selectAgentStatList");
TimeWindow timeWindow = new TimeWindow(new Range(from, to), new TimeWindowSlotCentricSampler());
LegacyAgentStatChartGroup chartGroup = this.v1Service.selectAgentStatList(agentId, timeWindow);
watch.stop();
if (logger.isInfoEnabled()) {
logger.info("getAgentStatV1(agentId={}, from={}, to={}) : {}ms", agentId, from, to, watch.getLastTaskTimeMillis());
}
return chartGroup;
}
use of org.springframework.security.access.prepost.PreAuthorize in project pinpoint by naver.
the class LegacyAgentStatController method getAgentStat.
@Deprecated
@PreAuthorize("hasPermission(new com.navercorp.pinpoint.web.vo.AgentParam(#agentId, #to), 'agentParam', 'inspector')")
@RequestMapping(value = "/getAgentStat", method = RequestMethod.GET)
@ResponseBody
public LegacyAgentStatChartGroup getAgentStat(@RequestParam("agentId") String agentId, @RequestParam("from") long from, @RequestParam("to") long to, @RequestParam(value = "sampleRate", required = false) Integer sampleRate) throws Exception {
StopWatch watch = new StopWatch();
watch.start("agentStatService.selectAgentStatList");
TimeWindow timeWindow = new TimeWindow(new Range(from, to), new TimeWindowSlotCentricSampler());
LegacyAgentStatChartGroup chartGroup = this.agentStatService.selectAgentStatList(agentId, timeWindow);
watch.stop();
if (logger.isInfoEnabled()) {
logger.info("getAgentStat(agentId={}, from={}, to={}) : {}ms", agentId, from, to, watch.getLastTaskTimeMillis());
}
return chartGroup;
}
use of org.springframework.security.access.prepost.PreAuthorize in project pinpoint by naver.
the class AgentStatController method getAgentStatChartList.
@PreAuthorize("hasPermission(new com.navercorp.pinpoint.web.vo.AgentParam(#agentId, #to), 'agentParam', 'inspector')")
@RequestMapping(value = "/chartList", method = RequestMethod.GET)
@ResponseBody
public List<AgentStatChartGroup> getAgentStatChartList(@RequestParam("agentId") String agentId, @RequestParam("from") long from, @RequestParam("to") long to) {
TimeWindowSampler sampler = new TimeWindowSlotCentricSampler();
TimeWindow timeWindow = new TimeWindow(new Range(from, to), sampler);
return this.agentStatChartService.selectAgentChartList(agentId, timeWindow);
}
Aggregations