Search in sources :

Example 41 with DomainObjectNotFoundException

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

the class UserMaintenanceTx method load.

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

Example 42 with DomainObjectNotFoundException

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

the class UserMaintenanceTx method load.

// .//GEN-END:_preprocessUpdate_2_be
// .//GEN-BEGIN:_loadUpdate_1_be
/**
 * Retrieve the domain object.
 */
private User load(UOW uow, UserMaintenanceUpdateInDto input) throws FrameworkException, ApplicationExceptions {
    User domain = null;
    Criteria criteria = new Criteria();
    criteria.setTable(UserMeta.getName());
    // .//GEN-END:_loadUpdate_1_be
    // Add custom criteria //GEN-FIRST:_loadUpdate_1
    // .//GEN-LAST:_loadUpdate_1
    // .//GEN-BEGIN:_loadUpdate_2_be
    criteria.addCriteria(UserMeta.USER_NAME, input.getUserName());
    criteria.setLocking(Criteria.LOCKING_PARANOID);
    Iterator itr = uow.query(criteria).iterator();
    if (itr.hasNext())
        domain = (User) itr.next();
    // .//GEN-END:_loadUpdate_2_be
    // Add custom code //GEN-FIRST:_loadUpdate_2
    oldPassword = domain.getPassword();
    oldStatus = domain.getStatus();
    // .//GEN-BEGIN:_loadUpdate_3_be
    if (domain == null) {
        ApplicationExceptions appExps = new ApplicationExceptions();
        appExps.add(new DomainObjectNotFoundException(UserMeta.getLabelToken()));
        throw appExps;
    }
    return domain;
}
Also used : User(org.jaffa.applications.jaffa.modules.admin.domain.User) ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) DomainObjectNotFoundException(org.jaffa.exceptions.DomainObjectNotFoundException) Criteria(org.jaffa.persistence.Criteria)

Example 43 with DomainObjectNotFoundException

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

the class UserMaintenanceTx method load.

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

Example 44 with DomainObjectNotFoundException

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

the class FormGroupMaintenanceTx method load.

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

Example 45 with DomainObjectNotFoundException

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

the class FormTemplateMaintenanceTx method load.

// .//GEN-END:_preprocessDelete_2_be
// .//GEN-BEGIN:_loadDelete_1_be
/**
 * Retrieve the domain object.
 */
private FormTemplate load(UOW uow, FormTemplateMaintenanceDeleteInDto input) throws FrameworkException, ApplicationExceptions {
    FormTemplate domain = null;
    Criteria criteria = new Criteria();
    criteria.setTable(FormTemplateMeta.getName());
    // .//GEN-END:_loadDelete_1_be
    // Add custom criteria //GEN-FIRST:_loadDelete_1
    // .//GEN-LAST:_loadDelete_1
    // .//GEN-BEGIN:_loadDelete_2_be
    criteria.addCriteria(FormTemplateMeta.FORM_ID, input.getFormId());
    criteria.setLocking(Criteria.LOCKING_PARANOID);
    Iterator itr = uow.query(criteria).iterator();
    if (itr.hasNext())
        domain = (FormTemplate) itr.next();
    // .//GEN-BEGIN:_loadDelete_3_be
    if (domain == null) {
        ApplicationExceptions appExps = new ApplicationExceptions();
        appExps.add(new DomainObjectNotFoundException(FormTemplateMeta.getLabelToken()));
        throw appExps;
    }
    return domain;
}
Also used : ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) DomainObjectNotFoundException(org.jaffa.exceptions.DomainObjectNotFoundException) FormTemplate(org.jaffa.modules.printing.domain.FormTemplate) 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