Search in sources :

Example 11 with OfficeException

use of org.mifos.customers.office.exceptions.OfficeException in project head by mifos.

the class OffAction method get.

@TransactionDemarcate(saveToken = true)
public ActionForward get(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    OffActionForm actionForm = (OffActionForm) form;
    if (StringUtils.isBlank(actionForm.getOfficeId())) {
        throw new OfficeException(OfficeConstants.KEYGETFAILED);
    }
    OfficeDto officeDto = this.officeServiceFacade.retrieveOfficeById(Short.valueOf(actionForm.getOfficeId()));
    actionForm.clear();
    List<CustomFieldDefinitionEntity> customFieldDefs = new ArrayList<CustomFieldDefinitionEntity>();
    SessionUtils.setCollectionAttribute(CustomerConstants.CUSTOM_FIELDS_LIST, customFieldDefs, request);
    actionForm.populate(officeDto);
    SessionUtils.setAttribute(OfficeConstants.OFFICE_DTO, officeDto, request);
    setCurrentPageUrl(request, officeDto);
    return mapping.findForward(ActionForwards.get_success.toString());
}
Also used : OfficeException(org.mifos.customers.office.exceptions.OfficeException) OfficeDto(org.mifos.dto.domain.OfficeDto) ArrayList(java.util.ArrayList) OffActionForm(org.mifos.customers.office.struts.actionforms.OffActionForm) CustomFieldDefinitionEntity(org.mifos.application.master.business.CustomFieldDefinitionEntity) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 12 with OfficeException

use of org.mifos.customers.office.exceptions.OfficeException in project head by mifos.

the class TestObjectFactory method generateSearchId.

private static String generateSearchId(OfficeBO parentOffice) throws OfficeException {
    Integer noOfChildern;
    try {
        noOfChildern = new OfficePersistence().getChildCount(parentOffice.getOfficeId());
    } catch (PersistenceException e) {
        throw new OfficeException(e);
    }
    String parentSearchId = HierarchyManager.getInstance().getSearchId(parentOffice.getOfficeId());
    parentSearchId += ++noOfChildern;
    parentSearchId += ".";
    return parentSearchId;
}
Also used : OfficeException(org.mifos.customers.office.exceptions.OfficeException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) OfficePersistence(org.mifos.customers.office.persistence.OfficePersistence)

Aggregations

OfficeException (org.mifos.customers.office.exceptions.OfficeException)12 PersistenceException (org.mifos.framework.exceptions.PersistenceException)7 OfficePersistence (org.mifos.customers.office.persistence.OfficePersistence)6 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)3 LinkedList (java.util.LinkedList)3 List (java.util.List)3 MifosRuntimeException (org.mifos.core.MifosRuntimeException)3 UserContextFactory (org.mifos.accounts.servicefacade.UserContextFactory)2 OfficeBO (org.mifos.customers.office.business.OfficeBO)2 OfficeValidationException (org.mifos.customers.office.exceptions.OfficeValidationException)2 MifosUser (org.mifos.security.MifosUser)2 OfficeCacheDto (org.mifos.security.util.OfficeCacheDto)2 UserContext (org.mifos.security.util.UserContext)2 BusinessRuleException (org.mifos.service.BusinessRuleException)2 CustomFieldDefinitionEntity (org.mifos.application.master.business.CustomFieldDefinitionEntity)1 OffActionForm (org.mifos.customers.office.struts.actionforms.OffActionForm)1 OfficeLevel (org.mifos.customers.office.util.helpers.OfficeLevel)1 OfficeStatus (org.mifos.customers.office.util.helpers.OfficeStatus)1 AddressDto (org.mifos.dto.domain.AddressDto)1