Search in sources :

Example 51 with DomainObjectNotFoundException

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

the class PrinterDefinitionMaintenanceTx method load.

// .//GEN-END:_preprocessRetrieve_2_be
// .//GEN-BEGIN:_loadRetrieve_1_be
/**
 * Retrieve the domain object.
 */
private PrinterDefinition load(UOW uow, PrinterDefinitionMaintenanceRetrieveInDto input) throws FrameworkException, ApplicationExceptions {
    PrinterDefinition domain = null;
    Criteria criteria = new Criteria();
    criteria.setTable(PrinterDefinitionMeta.getName());
    // .//GEN-END:_loadRetrieve_1_be
    // Add custom criteria//GEN-FIRST:_loadRetrieve_1
    // .//GEN-LAST:_loadRetrieve_1
    // .//GEN-BEGIN:_loadRetrieve_2_be
    criteria.addCriteria(PrinterDefinitionMeta.PRINTER_ID, input.getPrinterId());
    Iterator itr = uow.query(criteria).iterator();
    if (itr.hasNext())
        domain = (PrinterDefinition) itr.next();
    // .//GEN-BEGIN:_loadRetrieve_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)

Example 52 with DomainObjectNotFoundException

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

the class PrinterDefinitionMaintenanceTx method load.

// .//GEN-END:_preprocessUpdate_2_be
// .//GEN-BEGIN:_loadUpdate_1_be
/**
 * Retrieve the domain object.
 */
private PrinterDefinition load(UOW uow, PrinterDefinitionMaintenanceUpdateInDto input) throws FrameworkException, ApplicationExceptions {
    PrinterDefinition domain = null;
    Criteria criteria = new Criteria();
    criteria.setTable(PrinterDefinitionMeta.getName());
    // .//GEN-END:_loadUpdate_1_be
    // Add custom criteria//GEN-FIRST:_loadUpdate_1
    // .//GEN-LAST:_loadUpdate_1
    // .//GEN-BEGIN:_loadUpdate_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:_loadUpdate_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)

Example 53 with DomainObjectNotFoundException

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

the class PrinterDefinitionViewerComponent method doInquiry.

// .//GEN-END:_display_2_be
// .//GEN-BEGIN:_inquiry_1_be
private void doInquiry() throws ApplicationExceptions, FrameworkException {
    PrinterDefinitionViewerInDto inputDto = new PrinterDefinitionViewerInDto();
    // .//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.setPrinterId(m_printerId);
    inputDto.setHeaderDto(createHeaderDto());
    // create the Tx
    if (m_tx == null)
        m_tx = (IPrinterDefinitionViewer) Factory.createObject(IPrinterDefinitionViewer.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(PrinterDefinitionMeta.getLabelToken()));
        throw appExps;
    }
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) DomainObjectNotFoundException(org.jaffa.exceptions.DomainObjectNotFoundException) IPrinterDefinitionViewer(org.jaffa.modules.printing.components.printerdefinitionviewer.IPrinterDefinitionViewer) PrinterDefinitionViewerInDto(org.jaffa.modules.printing.components.printerdefinitionviewer.dto.PrinterDefinitionViewerInDto)

Example 54 with DomainObjectNotFoundException

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

the class PrinterOutputTypeMaintenanceTx method load.

// .//GEN-END:_preprocessUpdate_2_be
// .//GEN-BEGIN:_loadUpdate_1_be
/**
 * Retrieve the domain object.
 */
private PrinterOutputType load(UOW uow, PrinterOutputTypeMaintenanceUpdateInDto input) throws FrameworkException, ApplicationExceptions {
    PrinterOutputType domain = null;
    Criteria criteria = new Criteria();
    criteria.setTable(PrinterOutputTypeMeta.getName());
    // .//GEN-END:_loadUpdate_1_be
    // Add custom criteria //GEN-FIRST:_loadUpdate_1
    // .//GEN-LAST:_loadUpdate_1
    // .//GEN-BEGIN:_loadUpdate_2_be
    criteria.addCriteria(PrinterOutputTypeMeta.OUTPUT_TYPE, input.getOutputType());
    criteria.setLocking(Criteria.LOCKING_PARANOID);
    Iterator itr = uow.query(criteria).iterator();
    if (itr.hasNext())
        domain = (PrinterOutputType) itr.next();
    // .//GEN-BEGIN:_loadUpdate_3_be
    if (domain == null) {
        ApplicationExceptions appExps = new ApplicationExceptions();
        appExps.add(new DomainObjectNotFoundException(PrinterOutputTypeMeta.getLabelToken()));
        throw appExps;
    }
    return domain;
}
Also used : PrinterOutputType(org.jaffa.modules.printing.domain.PrinterOutputType) ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) DomainObjectNotFoundException(org.jaffa.exceptions.DomainObjectNotFoundException) Criteria(org.jaffa.persistence.Criteria)

Example 55 with DomainObjectNotFoundException

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

the class PrinterOutputTypeMaintenanceTx method load.

// .//GEN-END:_preprocessRetrieve_2_be
// .//GEN-BEGIN:_loadRetrieve_1_be
/**
 * Retrieve the domain object.
 */
private PrinterOutputType load(UOW uow, PrinterOutputTypeMaintenanceRetrieveInDto input) throws FrameworkException, ApplicationExceptions {
    PrinterOutputType domain = null;
    Criteria criteria = new Criteria();
    criteria.setTable(PrinterOutputTypeMeta.getName());
    // .//GEN-END:_loadRetrieve_1_be
    // Add custom criteria //GEN-FIRST:_loadRetrieve_1
    // .//GEN-LAST:_loadRetrieve_1
    // .//GEN-BEGIN:_loadRetrieve_2_be
    criteria.addCriteria(PrinterOutputTypeMeta.OUTPUT_TYPE, input.getOutputType());
    Iterator itr = uow.query(criteria).iterator();
    if (itr.hasNext())
        domain = (PrinterOutputType) itr.next();
    // .//GEN-BEGIN:_loadRetrieve_3_be
    if (domain == null) {
        ApplicationExceptions appExps = new ApplicationExceptions();
        appExps.add(new DomainObjectNotFoundException(PrinterOutputTypeMeta.getLabelToken()));
        throw appExps;
    }
    return domain;
}
Also used : PrinterOutputType(org.jaffa.modules.printing.domain.PrinterOutputType) 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