use of org.mifos.framework.exceptions.ServiceException in project head by mifos.
the class RolesPermissionsAction method getLoggedUsers.
private List<String> getLoggedUsers(HttpServletRequest request) {
List<String> loggedUsers = new ArrayList<String>();
ShutdownManager shutdownManager = (ShutdownManager) ServletUtils.getGlobal(request, ShutdownManager.class.getName());
Collection<HttpSession> sessions = shutdownManager.getActiveSessions();
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;
}
loggedUsers.add(personnel.getUserName());
}
return loggedUsers;
}
use of org.mifos.framework.exceptions.ServiceException in project head by mifos.
the class LoanBusinessService method getAppllicablePenalties.
public List<ApplicableCharge> getAppllicablePenalties(Integer accountId, UserContext userContext) throws ServiceException {
List<ApplicableCharge> applicableChargeList = null;
try {
LoanBO loan = getlegacyLoanDao().getAccount(accountId);
applicableChargeList = getLoanApplicablePenalties(getlegacyLoanDao().getAllApplicablePenalties(accountId), userContext, loan);
} catch (PersistenceException pe) {
throw new ServiceException(pe);
}
addMiscPenalty(applicableChargeList);
return applicableChargeList;
}
use of org.mifos.framework.exceptions.ServiceException in project head by mifos.
the class LoanPrdBusinessServiceTest method testInvalidConnectionThrowsExceptionInGetAllLoanOfferings.
@Test
@ExpectedException(value = ServiceException.class)
public void testInvalidConnectionThrowsExceptionInGetAllLoanOfferings() throws PersistenceException {
try {
when(loanPrdPersistence.getAllLoanOfferings(localeId)).thenThrow(new PersistenceException("some exception"));
loanPrdBusinessService.getAllLoanOfferings(localeId);
Assert.fail("should fail because of invalid session");
} catch (ServiceException e) {
}
}
use of org.mifos.framework.exceptions.ServiceException in project head by mifos.
the class LoanPrdBusinessServiceTest method testInvalidConnectionThrowsExceptionInGetLoanOffering.
@Test
@ExpectedException(value = ServiceException.class)
public void testInvalidConnectionThrowsExceptionInGetLoanOffering() throws PersistenceException {
try {
when(loanPrdPersistence.getLoanOffering(new Short("112"))).thenThrow(new PersistenceException("some exception"));
loanPrdBusinessService.getLoanOffering(new Short("112"));
Assert.fail("should fail because of invalid session");
} catch (ServiceException e) {
}
}
use of org.mifos.framework.exceptions.ServiceException in project head by mifos.
the class LoanPrdBusinessServiceTest method testInvalidConnectionThrowsExceptionInGetLoanOfferingWithLocaleId.
@Test
@ExpectedException(value = ServiceException.class)
public void testInvalidConnectionThrowsExceptionInGetLoanOfferingWithLocaleId() throws PersistenceException {
try {
when(loanPrdPersistence.getLoanOffering(new Short("112"), localeId)).thenThrow(new PersistenceException("some exception"));
loanPrdBusinessService.getLoanOffering(new Short("112"), localeId);
Assert.fail("should fail because of invalid session");
} catch (ServiceException e) {
}
}
Aggregations