use of org.mifos.framework.exceptions.SystemException in project head by mifos.
the class ReportsPersistence method deleteReportsParamsMap.
/**
* Deletes a link between report and a parameter
*/
public void deleteReportsParamsMap(ReportsParamsMapValue reportsParamsMapValue) throws ApplicationException, SystemException {
Session session = null;
try {
session = StaticHibernateUtil.getSessionTL();
StaticHibernateUtil.startTransaction();
session.delete(reportsParamsMapValue);
session.flush();
StaticHibernateUtil.commitTransaction();
} catch (HibernateProcessException hpe) {
StaticHibernateUtil.rollbackTransaction();
throw new ApplicationException(hpe);
} catch (HibernateException e) {
StaticHibernateUtil.rollbackTransaction();
throw new ReportException(ReportsConstants.CREATE_FAILED_EXCEPTION, e);
} catch (Exception e) {
StaticHibernateUtil.rollbackTransaction();
throw new ReportException(ReportsConstants.CREATE_FAILED_EXCEPTION, e);
} finally {
StaticHibernateUtil.closeSession();
}
}
use of org.mifos.framework.exceptions.SystemException in project head by mifos.
the class ReportsPersistence method deleteReportParams.
public void deleteReportParams(ReportsParamsValue reportsParams) throws ApplicationException, SystemException {
Session session = null;
try {
session = StaticHibernateUtil.getSessionTL();
StaticHibernateUtil.startTransaction();
session.delete(reportsParams);
session.flush();
StaticHibernateUtil.commitTransaction();
} catch (HibernateProcessException hpe) {
StaticHibernateUtil.rollbackTransaction();
throw new ApplicationException(hpe);
} catch (HibernateException e) {
StaticHibernateUtil.rollbackTransaction();
throw new ReportException(ReportsConstants.CREATE_FAILED_EXCEPTION, e);
} catch (Exception e) {
StaticHibernateUtil.rollbackTransaction();
throw new ReportException(ReportsConstants.CREATE_FAILED_EXCEPTION, e);
} finally {
StaticHibernateUtil.closeSession();
}
}
use of org.mifos.framework.exceptions.SystemException in project head by mifos.
the class ReportsPersistence method updateReportsJasperMap.
/**
* sets a link between report and a jasper file
*/
public void updateReportsJasperMap(ReportsJasperMap reportsJasperMap) throws ApplicationException, SystemException {
Session session = null;
try {
session = StaticHibernateUtil.getSessionTL();
StaticHibernateUtil.startTransaction();
session.update(reportsJasperMap);
session.flush();
StaticHibernateUtil.commitTransaction();
} catch (HibernateProcessException e) {
StaticHibernateUtil.rollbackTransaction();
throw new ApplicationException(e);
} catch (HibernateException e) {
StaticHibernateUtil.rollbackTransaction();
throw new ReportException(ReportsConstants.CREATE_FAILED_EXCEPTION, e);
} catch (Exception e) {
StaticHibernateUtil.rollbackTransaction();
throw new ReportException(ReportsConstants.CREATE_FAILED_EXCEPTION, e);
} finally {
StaticHibernateUtil.closeSession();
}
}
use of org.mifos.framework.exceptions.SystemException in project head by mifos.
the class QuestionnaireValidatorImpl method validateForDefineQuestionGroup.
@Override
public void validateForDefineQuestionGroup(QuestionGroupDto questionGroupDto, boolean withDuplicateQuestionTextCheck) {
ValidationException parentException = new ValidationException(GENERIC_VALIDATION);
validateQuestionGroupTitle(questionGroupDto, parentException);
List<EventSourceDto> eventSourceDtos = questionGroupDto.getEventSourceDtos();
if (eventSourceDtos == null || eventSourceDtos.size() == 0) {
throw new SystemException(INVALID_EVENT_SOURCE);
} else {
for (EventSourceDto eventSourceDto : eventSourceDtos) {
validateEventSource(eventSourceDto, parentException);
}
}
validateSections(questionGroupDto.getSections(), parentException, withDuplicateQuestionTextCheck);
if (parentException.hasChildExceptions()) {
throw parentException;
}
}
use of org.mifos.framework.exceptions.SystemException in project head by mifos.
the class QuestionnaireServiceTest method shouldThrowValidationExceptionWhenQuestionTitleIsNull.
@SuppressWarnings({ "ThrowableInstanceNeverThrown" })
@Test(expected = SystemException.class)
public void shouldThrowValidationExceptionWhenQuestionTitleIsNull() throws SystemException {
QuestionDetail questionDefinition = new QuestionDetail(null, QuestionType.INVALID);
doThrow(new SystemException(QuestionnaireConstants.QUESTION_TEXT_NOT_PROVIDED)).when(questionnaireValidator).validateForDefineQuestion(questionDefinition);
questionnaireService.defineQuestion(questionDefinition);
verify(questionnaireValidator).validateForDefineQuestion(questionDefinition);
}
Aggregations