use of org.mifos.framework.exceptions.FrameworkRuntimeException in project head by mifos.
the class LoanAccountActionForm method validateRedoLoanPayments.
private void validateRedoLoanPayments(HttpServletRequest request, ActionErrors errors, MifosCurrency currency) {
Locale locale = getUserContext(request).getPreferredLocale();
try {
CustomerBO customer = getCustomer(request);
List<PaymentDataHtmlBean> validPaymentBeans = getValidatablePaymentBeans();
for (PaymentDataHtmlBean bean : validPaymentBeans) {
validatePaymentDataHtmlBean(errors, currency, locale, customer, bean);
}
validatePaymentDatesOrdering(validPaymentBeans, errors);
validateMaxPayableAmount(request, errors);
} catch (InvalidDateException invalidDate) {
errors.add(LoanExceptionConstants.INVALIDTRANSACTIONDATE, new ActionMessage(LoanExceptionConstants.INVALIDTRANSACTIONDATE));
} catch (FrameworkRuntimeException invalidDate) {
errors.add(LoanExceptionConstants.INVALIDTRANSACTIONDATE, new ActionMessage(LoanExceptionConstants.INVALIDTRANSACTIONDATE));
} catch (MeetingException e) {
errors.add(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION, new ActionMessage(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION));
} catch (PageExpiredException e) {
errors.add(ExceptionConstants.PAGEEXPIREDEXCEPTION, new ActionMessage(ExceptionConstants.PAGEEXPIREDEXCEPTION));
} catch (PersistenceException e) {
errors.add(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION, new ActionMessage(ExceptionConstants.FRAMEWORKRUNTIMEEXCEPTION));
}
}
use of org.mifos.framework.exceptions.FrameworkRuntimeException in project head by mifos.
the class DateUtils method getDate.
public static Date getDate(String value, Locale dateLocale, String formatStr) {
if (value != null && !value.equals("")) {
try {
SimpleDateFormat format = new SimpleDateFormat(formatStr, dateLocale);
format.setLenient(false);
return format.parse(value);
} catch (Exception e) {
throw new FrameworkRuntimeException(e);
}
}
return null;
}
use of org.mifos.framework.exceptions.FrameworkRuntimeException in project head by mifos.
the class DateUtils method getUserLocaleDate.
public static String getUserLocaleDate(String databaseDate) {
if (internalLocale != null && databaseDate != null && !databaseDate.equals("")) {
try {
SimpleDateFormat shortFormat = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, internalLocale);
String userfmt = convertToCurrentDateFormat(shortFormat.toPattern());
return convertDbToUserFmt(databaseDate, userfmt);
} catch (FrameworkRuntimeException e) {
throw e;
} catch (Exception e) {
System.out.println("databaseDate=" + databaseDate + ", locale=" + internalLocale);
throw new FrameworkRuntimeException(e);
}
} else {
return "";
}
}
use of org.mifos.framework.exceptions.FrameworkRuntimeException in project head by mifos.
the class DateUtils method getLocaleDate.
public static java.sql.Date getLocaleDate(String value) {
if (internalLocale != null && value != null && !value.equals("")) {
try {
SimpleDateFormat shortFormat = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, internalLocale);
shortFormat.setLenient(false);
String userPattern = shortFormat.toPattern();
String dbDate = convertUserToDbFmt(value, userPattern);
return java.sql.Date.valueOf(dbDate);
} catch (RuntimeException alreadyRuntime) {
throw alreadyRuntime;
} catch (Exception e) {
throw new FrameworkRuntimeException(e);
}
} else {
return null;
}
}
use of org.mifos.framework.exceptions.FrameworkRuntimeException in project head by mifos.
the class DateUtils method getUserLocaleDate.
public static String getUserLocaleDate(Locale locale, String databaseDate) {
// the following line is for 1.1 release and will be removed when date
// is localized
locale = internalLocale;
if (locale != null && databaseDate != null && !databaseDate.equals("")) {
try {
SimpleDateFormat shortFormat = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, locale);
String userfmt = convertToCurrentDateFormat(shortFormat.toPattern());
return convertDbToUserFmt(databaseDate, userfmt);
} catch (FrameworkRuntimeException e) {
throw e;
} catch (Exception e) {
System.out.println("databaseDate=" + databaseDate + ", locale=" + locale);
throw new FrameworkRuntimeException(e);
}
} else {
return "";
}
}
Aggregations