use of org.mifos.framework.exceptions.SystemException in project head by mifos.
the class AuditConfiguration method fetchMasterData.
private void fetchMasterData(String entityName, Short localeId, String classPath) throws SystemException {
Class clazz = null;
try {
clazz = Thread.currentThread().getContextClassLoader().loadClass(classPath);
} catch (ClassNotFoundException e) {
throw new SystemException(e);
}
List<MasterDataEntity> masterDataList = legacyMasterDao.findMasterDataEntities(clazz);
for (MasterDataEntity masterDataEntity : masterDataList) {
if (masterDataEntity instanceof PersonnelStatusEntity) {
String name = ApplicationContextProvider.getBean(MessageLookup.class).lookup(masterDataEntity.getLookUpValue());
((PersonnelStatusEntity) masterDataEntity).setName(name);
}
if (masterDataEntity instanceof PersonnelLevelEntity) {
String name = ApplicationContextProvider.getBean(MessageLookup.class).lookup(masterDataEntity.getLookUpValue());
((PersonnelLevelEntity) masterDataEntity).setName(name);
}
if (masterDataEntity instanceof OfficeLevelEntity) {
String name = ApplicationContextProvider.getBean(MessageLookup.class).lookup(masterDataEntity.getLookUpValue());
((OfficeLevelEntity) masterDataEntity).setName(name);
}
if (masterDataEntity instanceof OfficeStatusEntity) {
String name = ApplicationContextProvider.getBean(MessageLookup.class).lookup(masterDataEntity.getLookUpValue());
((OfficeStatusEntity) masterDataEntity).setName(name);
}
valueMap.put(masterDataEntity.getId().toString(), masterDataEntity.getName());
}
}
use of org.mifos.framework.exceptions.SystemException in project head by mifos.
the class AuditConfiguration method callMethodToCreateValueMap.
//FIXME I use reflect for invoking methods of Dao (Not type safe)
private Map<String, String> callMethodToCreateValueMap(String methodName, Short localeId) throws SystemException {
valueMap = new HashMap<String, String>();
Method[] methods = LegacyAuditLookupValuesDao.class.getMethods();
for (Method method : methods) {
if (method.getName().equalsIgnoreCase(methodName)) {
try {
LegacyAuditLookupValuesDao legacyAuditLookupValuesDao = ApplicationContextProvider.getBean(LegacyAuditLookupValuesDao.class);
valueMap = (Map<String, String>) method.invoke(legacyAuditLookupValuesDao, new Object[] { localeId });
} catch (Exception e) {
throw new SystemException(e);
}
}
}
return valueMap;
}
use of org.mifos.framework.exceptions.SystemException in project head by mifos.
the class XMLParser method parser.
public ColumnPropertyMapping parser() throws SystemException {
Document document = null;
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse(MifosResourceUtil.getClassPathResourceAsStream("org/mifos/framework/util/resources/audit/ColumnMapping.xml"));
getColumnPropertyMapping(document);
} catch (ParserConfigurationException e) {
throw new SystemException(e);
} catch (IOException e) {
throw new SystemException(e);
} catch (SAXParseException e) {
throw new SystemException(e);
} catch (SAXException e) {
throw new SystemException(e);
}
return columnPropertyMapping;
}
use of org.mifos.framework.exceptions.SystemException in project head by mifos.
the class LanguageUpgrade method getLargestLanguageId.
private int getLargestLanguageId(Connection connection) throws SQLException {
Statement statement = connection.createStatement();
ResultSet results = statement.executeQuery("select max(lang_id) from language");
if (!results.next()) {
throw new SystemException(SystemException.DEFAULT_KEY, "Did not find an existing lang_id in language table");
}
int largestLangId = results.getInt(1);
results.close();
statement.close();
return largestLangId;
}
use of org.mifos.framework.exceptions.SystemException in project head by mifos.
the class BulkEntryTag method doStartTag.
@SuppressWarnings("unchecked")
@Override
public int doStartTag() throws JspException {
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
JspWriter out = pageContext.getOut();
StringBuilder builder = new StringBuilder();
CollectionSheetEntryGridDto bulkEntry = null;
try {
bulkEntry = (CollectionSheetEntryGridDto) SessionUtils.getAttribute(CollectionSheetEntryConstants.BULKENTRY, request);
} catch (PageExpiredException e) {
logger.error("Page expired getting BulkEntryBO.");
}
if (null != bulkEntry) {
List<ProductDto> loanProducts = bulkEntry.getLoanProducts();
List<ProductDto> savingsProducts = bulkEntry.getSavingProducts();
try {
final List<CustomValueListElementDto> custAttTypes = (List<CustomValueListElementDto>) SessionUtils.getAttribute(CollectionSheetEntryConstants.CUSTOMERATTENDANCETYPES, request);
String method = request.getParameter(CollectionSheetEntryConstants.METHOD);
generateTagData(bulkEntry, loanProducts, savingsProducts, custAttTypes, method, builder);
} catch (ApplicationException ae) {
throw new JspException(ae);
} catch (SystemException se) {
throw new JspException(se);
}
}
try {
out.write(builder.toString());
} catch (IOException ioe) {
throw new JspException(ioe);
}
return SKIP_BODY;
}
Aggregations