Search in sources :

Example 46 with DomainObjectNotFoundException

use of org.jaffa.exceptions.DomainObjectNotFoundException in project jaffa-framework by jaffa-projects.

the class FormTemplateViewerComponent method doInquiry.

// .//GEN-END:_display_2_be
// .//GEN-BEGIN:_inquiry_1_be
private void doInquiry() throws ApplicationExceptions, FrameworkException {
    FormTemplateViewerInDto inputDto = new FormTemplateViewerInDto();
    // .//GEN-END:_inquiry_1_be
    // Add custom code before building the input dto //GEN-FIRST:_inquiry_1
    // .//GEN-LAST:_inquiry_1
    // .//GEN-BEGIN:_inquiry_2_be
    inputDto.setFormId(m_formId);
    inputDto.setHeaderDto(createHeaderDto());
    // create the Tx
    if (m_tx == null)
        m_tx = (IFormTemplateViewer) Factory.createObject(IFormTemplateViewer.class);
    // .//GEN-END:_inquiry_2_be
    // Add custom code before invoking the Tx //GEN-FIRST:_inquiry_2
    // .//GEN-LAST:_inquiry_2
    // .//GEN-BEGIN:_inquiry_3_be
    // now get the details
    m_outputDto = m_tx.read(inputDto);
    // uncache the widgets
    getUserSession().getWidgetCache(getComponentId()).clear();
    // throw an exception if the output is null
    if (m_outputDto == null) {
        ApplicationExceptions appExps = new ApplicationExceptions();
        appExps.add(new DomainObjectNotFoundException(FormTemplateMeta.getLabelToken()));
        throw appExps;
    }
}
Also used : IFormTemplateViewer(org.jaffa.modules.printing.components.formtemplateviewer.IFormTemplateViewer) ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) DomainObjectNotFoundException(org.jaffa.exceptions.DomainObjectNotFoundException) FormTemplateViewerInDto(org.jaffa.modules.printing.components.formtemplateviewer.dto.FormTemplateViewerInDto)

Example 47 with DomainObjectNotFoundException

use of org.jaffa.exceptions.DomainObjectNotFoundException in project jaffa-framework by jaffa-projects.

the class FormUsageMaintenanceTx method load.

// .//GEN-END:_preprocessRetrieve_2_be
// .//GEN-BEGIN:_loadRetrieve_1_be
/**
 * Retrieve the domain object.
 */
private FormUsage load(UOW uow, FormUsageMaintenanceRetrieveInDto input) throws FrameworkException, ApplicationExceptions {
    FormUsage domain = null;
    Criteria criteria = new Criteria();
    criteria.setTable(FormUsageMeta.getName());
    // .//GEN-END:_loadRetrieve_1_be
    // Add custom criteria //GEN-FIRST:_loadRetrieve_1
    // .//GEN-LAST:_loadRetrieve_1
    // .//GEN-BEGIN:_loadRetrieve_2_be
    criteria.addCriteria(FormUsageMeta.FORM_NAME, input.getFormName());
    Iterator itr = uow.query(criteria).iterator();
    if (itr.hasNext())
        domain = (FormUsage) itr.next();
    // .//GEN-BEGIN:_loadRetrieve_3_be
    if (domain == null) {
        ApplicationExceptions appExps = new ApplicationExceptions();
        appExps.add(new DomainObjectNotFoundException(FormUsageMeta.getLabelToken()));
        throw appExps;
    }
    return domain;
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) DomainObjectNotFoundException(org.jaffa.exceptions.DomainObjectNotFoundException) Criteria(org.jaffa.persistence.Criteria) FormUsage(org.jaffa.modules.printing.domain.FormUsage)

Example 48 with DomainObjectNotFoundException

use of org.jaffa.exceptions.DomainObjectNotFoundException in project jaffa-framework by jaffa-projects.

the class FormUsageViewerComponent method doInquiry.

// .//GEN-END:_display_2_be
// .//GEN-BEGIN:_inquiry_1_be
private void doInquiry() throws ApplicationExceptions, FrameworkException {
    FormUsageViewerInDto inputDto = new FormUsageViewerInDto();
    // .//GEN-END:_inquiry_1_be
    // Add custom code before building the input dto //GEN-FIRST:_inquiry_1
    // .//GEN-LAST:_inquiry_1
    // .//GEN-BEGIN:_inquiry_2_be
    inputDto.setFormName(m_formName);
    inputDto.setHeaderDto(createHeaderDto());
    // create the Tx
    if (m_tx == null)
        m_tx = (IFormUsageViewer) Factory.createObject(IFormUsageViewer.class);
    // .//GEN-END:_inquiry_2_be
    // Add custom code before invoking the Tx //GEN-FIRST:_inquiry_2
    // .//GEN-LAST:_inquiry_2
    // .//GEN-BEGIN:_inquiry_3_be
    // now get the details
    m_outputDto = m_tx.read(inputDto);
    // uncache the widgets
    getUserSession().getWidgetCache(getComponentId()).clear();
    // throw an exception if the output is null
    if (m_outputDto == null) {
        ApplicationExceptions appExps = new ApplicationExceptions();
        appExps.add(new DomainObjectNotFoundException(FormUsageMeta.getLabelToken()));
        throw appExps;
    }
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) DomainObjectNotFoundException(org.jaffa.exceptions.DomainObjectNotFoundException) IFormUsageViewer(org.jaffa.modules.printing.components.formusageviewer.IFormUsageViewer) FormUsageViewerInDto(org.jaffa.modules.printing.components.formusageviewer.dto.FormUsageViewerInDto)

Example 49 with DomainObjectNotFoundException

use of org.jaffa.exceptions.DomainObjectNotFoundException in project jaffa-framework by jaffa-projects.

the class OutputCommandMaintenanceTx method load.

// .//GEN-END:_preprocessRetrieve_2_be
// .//GEN-BEGIN:_loadRetrieve_1_be
/**
 * Retrieve the domain object.
 */
private OutputCommand load(UOW uow, OutputCommandMaintenanceRetrieveInDto input) throws FrameworkException, ApplicationExceptions {
    OutputCommand domain = null;
    Criteria criteria = new Criteria();
    criteria.setTable(OutputCommandMeta.getName());
    // .//GEN-END:_loadRetrieve_1_be
    // Add custom criteria//GEN-FIRST:_loadRetrieve_1
    // .//GEN-LAST:_loadRetrieve_1
    // .//GEN-BEGIN:_loadRetrieve_2_be
    criteria.addCriteria(OutputCommandMeta.OUTPUT_COMMAND_ID, input.getOutputCommandId());
    Iterator itr = uow.query(criteria).iterator();
    if (itr.hasNext())
        domain = (OutputCommand) itr.next();
    // .//GEN-BEGIN:_loadRetrieve_3_be
    if (domain == null) {
        ApplicationExceptions appExps = new ApplicationExceptions();
        appExps.add(new DomainObjectNotFoundException(OutputCommandMeta.getLabelToken()));
        throw appExps;
    }
    return domain;
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) DomainObjectNotFoundException(org.jaffa.exceptions.DomainObjectNotFoundException) OutputCommand(org.jaffa.modules.printing.domain.OutputCommand) Criteria(org.jaffa.persistence.Criteria)

Example 50 with DomainObjectNotFoundException

use of org.jaffa.exceptions.DomainObjectNotFoundException in project jaffa-framework by jaffa-projects.

the class PrinterDefinitionMaintenanceTx method load.

// .//GEN-END:_preprocessDelete_2_be
// .//GEN-BEGIN:_loadDelete_1_be
/**
 * Retrieve the domain object.
 */
private PrinterDefinition load(UOW uow, PrinterDefinitionMaintenanceDeleteInDto input) throws FrameworkException, ApplicationExceptions {
    PrinterDefinition domain = null;
    Criteria criteria = new Criteria();
    criteria.setTable(PrinterDefinitionMeta.getName());
    // .//GEN-END:_loadDelete_1_be
    // Add custom criteria//GEN-FIRST:_loadDelete_1
    // .//GEN-LAST:_loadDelete_1
    // .//GEN-BEGIN:_loadDelete_2_be
    criteria.addCriteria(PrinterDefinitionMeta.PRINTER_ID, input.getPrinterId());
    criteria.setLocking(Criteria.LOCKING_PARANOID);
    Iterator itr = uow.query(criteria).iterator();
    if (itr.hasNext())
        domain = (PrinterDefinition) itr.next();
    // .//GEN-BEGIN:_loadDelete_3_be
    if (domain == null) {
        ApplicationExceptions appExps = new ApplicationExceptions();
        appExps.add(new DomainObjectNotFoundException(PrinterDefinitionMeta.getLabelToken()));
        throw appExps;
    }
    return domain;
}
Also used : PrinterDefinition(org.jaffa.modules.printing.domain.PrinterDefinition) ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) DomainObjectNotFoundException(org.jaffa.exceptions.DomainObjectNotFoundException) Criteria(org.jaffa.persistence.Criteria)

Aggregations

DomainObjectNotFoundException (org.jaffa.exceptions.DomainObjectNotFoundException)62 ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)57 Criteria (org.jaffa.persistence.Criteria)39 FrameworkException (org.jaffa.exceptions.FrameworkException)10 ApplicationException (org.jaffa.exceptions.ApplicationException)9 Method (java.lang.reflect.Method)6 UOW (org.jaffa.persistence.UOW)6 InvocationTargetException (java.lang.reflect.InvocationTargetException)5 Iterator (java.util.Iterator)5 LinkedHashMap (java.util.LinkedHashMap)5 Map (java.util.Map)5 IPersistent (org.jaffa.persistence.IPersistent)5 MultipleDomainObjectsFoundException (org.jaffa.exceptions.MultipleDomainObjectsFoundException)4 OutputCommand (org.jaffa.modules.printing.domain.OutputCommand)4 PrinterOutputType (org.jaffa.modules.printing.domain.PrinterOutputType)4 HashMap (java.util.HashMap)3 User (org.jaffa.applications.jaffa.modules.admin.domain.User)3 UserRequest (org.jaffa.applications.jaffa.modules.user.domain.UserRequest)3 UserTimeEntry (org.jaffa.applications.test.modules.time.domain.UserTimeEntry)3 GraphMapping (org.jaffa.beans.moulding.mapping.GraphMapping)3