Search in sources :

Example 21 with DateTimeFormatter

use of org.joda.time.format.DateTimeFormatter 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)

Example 22 with DateTimeFormatter

use of org.joda.time.format.DateTimeFormatter in project head by mifos.

the class ShutdownServiceFacadeWebTier method getLoggedUsers.

@Override
public List<LoggedUserDto> getLoggedUsers(HttpServletRequest request) {
    ShutdownManager shutdownManager = (ShutdownManager) ServletUtils.getGlobal(request, ShutdownManager.class.getName());
    Collection<HttpSession> sessions = shutdownManager.getActiveSessions();
    List<PersonnelInfo> personnelInfos = new ArrayList<PersonnelInfo>();
    UserContext userContext = (UserContext) SessionUtils.getAttribute(Constants.USER_CONTEXT_KEY, request.getSession());
    if (ActivityMapper.getInstance().isViewActiveSessionsPermitted(userContext, userContext.getBranchId())) {
        PersonnelBusinessService personnelBusinessService = new PersonnelBusinessService();
        for (HttpSession session : sessions) {
            UserContext userContextFromSession = (UserContext) session.getAttribute(LoginConstants.USERCONTEXT);
            if (userContextFromSession == null) {
                continue;
            }
            PersonnelBO personnel;
            try {
                personnel = personnelBusinessService.getPersonnel(userContextFromSession.getId());
            } catch (ServiceException e) {
                continue;
            }
            String offices = generateOfficeChain(personnel.getOffice());
            String names = personnel.getPersonnelDetails().getName().getFirstName() + " " + personnel.getPersonnelDetails().getName().getLastName();
            DateTimeFormatter formatter = DateTimeFormat.shortDateTime().withOffsetParsed().withLocale(userContext.getCurrentLocale());
            String activityTime = formatter.print(session.getLastAccessedTime());
            ActivityContext activityContext = (ActivityContext) session.getAttribute(LoginConstants.ACTIVITYCONTEXT);
            String activityDesc = "[" + activityContext.getLastForward().getName() + "] " + activityContext.getLastForward().getPath();
            personnelInfos.add(new PersonnelInfo(offices, names, activityTime, activityDesc));
        }
    }
    Collections.sort(personnelInfos);
    List<LoggedUserDto> loggedUsers = new ArrayList<LoggedUserDto>();
    for (PersonnelInfo personnelInfo : personnelInfos) {
        loggedUsers.add(new LoggedUserDto(personnelInfo.getOffices(), personnelInfo.getNames(), personnelInfo.getActivityTime(), personnelInfo.getActivityContext()));
    }
    return loggedUsers;
}
Also used : ActivityContext(org.mifos.security.util.ActivityContext) PersonnelBusinessService(org.mifos.customers.personnel.business.service.PersonnelBusinessService) HttpSession(javax.servlet.http.HttpSession) UserContext(org.mifos.security.util.UserContext) ArrayList(java.util.ArrayList) PersonnelInfo(org.mifos.application.admin.system.PersonnelInfo) ShutdownManager(org.mifos.application.admin.system.ShutdownManager) ServiceException(org.mifos.framework.exceptions.ServiceException) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) LoggedUserDto(org.mifos.application.admin.servicefacade.LoggedUserDto) DateTimeFormatter(org.joda.time.format.DateTimeFormatter)

Example 23 with DateTimeFormatter

use of org.joda.time.format.DateTimeFormatter in project head by mifos.

the class DateTimeUpdaterRemoteTestingService method setDateTime.

public TimeMachinePage setDateTime(DateTime dateTime, DateTimeZone dateTimeZone) throws UnsupportedEncodingException {
    DateTimeFormatter formatter = ISODateTimeFormat.basicDateTimeNoMillis().withZone(dateTimeZone);
    String timeMachineUrl = "dateTimeUpdate.ftl?dateTime=" + getUrlEncodedTimeMachineDate(dateTime, formatter);
    selenium.open(timeMachineUrl);
    waitForPageToLoad();
    return new TimeMachinePage(selenium);
}
Also used : TimeMachinePage(org.mifos.test.acceptance.framework.TimeMachinePage) DateTimeFormatter(org.joda.time.format.DateTimeFormatter)

Example 24 with DateTimeFormatter

use of org.joda.time.format.DateTimeFormatter in project head by mifos.

the class MonthClosingFormBean method getFormattedDate.

public String getFormattedDate() {
    DateTimeFormatter formatter = org.joda.time.format.DateTimeFormat.forStyle("S-").withLocale(Locale.getDefault());
    String printedDate = "";
    if (date != null) {
        printedDate = formatter.print(date);
    }
    return printedDate;
}
Also used : DateTimeFormatter(org.joda.time.format.DateTimeFormatter)

Example 25 with DateTimeFormatter

use of org.joda.time.format.DateTimeFormatter in project head by mifos.

the class LoanScheduleFormBean method parseInstallment.

public String parseInstallment(int index) {
    DateTimeFormatter formatter = org.joda.time.format.DateTimeFormat.forStyle("S-").withLocale(Locale.getDefault());
    DateTime dueDate = this.installments.get(index);
    String printedDate = "";
    if (dueDate != null) {
        printedDate = formatter.print(dueDate);
    }
    return printedDate;
}
Also used : DateTimeFormatter(org.joda.time.format.DateTimeFormatter) DateTime(org.joda.time.DateTime)

Aggregations

DateTimeFormatter (org.joda.time.format.DateTimeFormatter)209 DateTime (org.joda.time.DateTime)95 Date (java.util.Date)40 Test (org.junit.Test)25 DateTimeZone (org.joda.time.DateTimeZone)19 ArrayList (java.util.ArrayList)16 HashMap (java.util.HashMap)16 SolrInputDocument (org.apache.solr.common.SolrInputDocument)12 IndexSchema (org.apache.solr.schema.IndexSchema)12 DateTimeFormatterBuilder (org.joda.time.format.DateTimeFormatterBuilder)12 CswSourceConfiguration (org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration)10 IOException (java.io.IOException)9 Calendar (java.util.Calendar)8 Map (java.util.Map)8 DatasetConfigDTO (com.linkedin.thirdeye.datalayer.dto.DatasetConfigDTO)7 FormatDateTimeFormatter (org.elasticsearch.common.joda.FormatDateTimeFormatter)7 Test (org.testng.annotations.Test)7 TimeSpec (com.linkedin.thirdeye.api.TimeSpec)6 FilterType (net.opengis.filter.v_1_1_0.FilterType)6 Deployment (org.activiti.engine.test.Deployment)6