Search in sources :

Example 36 with DomainObjectNotFoundException

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

the class AttachmentMaintenanceTx method load.

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

Example 37 with DomainObjectNotFoundException

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

the class AttachmentMaintenanceTx method load.

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

Example 38 with DomainObjectNotFoundException

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

the class AttachmentViewerComponent method doInquiry.

// .//GEN-END:_display_2_be
// .//GEN-BEGIN:_inquiry_1_be
private void doInquiry() throws ApplicationExceptions, FrameworkException {
    AttachmentViewerInDto inputDto = new AttachmentViewerInDto();
    // .//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.setAttachmentId(m_attachmentId);
    inputDto.setHeaderDto(createHeaderDto());
    // create the Tx
    if (m_tx == null)
        m_tx = (IAttachmentViewer) Factory.createObject(IAttachmentViewer.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(AttachmentMeta.getLabelToken()));
        throw appExps;
    }
}
Also used : AttachmentViewerInDto(org.jaffa.components.attachment.components.attachmentviewer.dto.AttachmentViewerInDto) ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) DomainObjectNotFoundException(org.jaffa.exceptions.DomainObjectNotFoundException) IAttachmentViewer(org.jaffa.components.attachment.components.attachmentviewer.IAttachmentViewer)

Example 39 with DomainObjectNotFoundException

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

the class RequestPasswordForm method doValidate0.

/**
 * This method should be invoked to ensure a valid state of the FormBean. It will validate the data in the models and set the corresponding properties.
 * Errors will be raised in the FormBean, if any validation fails.
 * @param request The request stream
 * @return A true indicates validations went through successfully.
 */
public boolean doValidate0(HttpServletRequest request) {
    boolean valid = true;
    String htmlString = null;
    htmlString = getUserNameWM().getValue();
    if (htmlString != null && htmlString.length() == 0)
        htmlString = null;
    java.lang.String userNameValue = Parser.parseString(htmlString);
    setUserName(userNameValue);
    htmlString = getEmailWM().getValue();
    if (htmlString != null && htmlString.length() == 0)
        htmlString = null;
    java.lang.String emailValue = Parser.parseString(htmlString);
    setEmail(emailValue);
    java.lang.String securityQuestionValue = getSecurityQuestionWM().getValue();
    setSecurityQuestion(securityQuestionValue);
    htmlString = getSecurityAnswerWM().getValue();
    if (htmlString != null && htmlString.length() == 0)
        htmlString = null;
    java.lang.String securityAnswerValue = Parser.parseString(htmlString);
    setSecurityAnswer(securityAnswerValue);
    if (this.getEmail() == null && this.getSecurityAnswer() == null && this.getSecurityQuestion().equalsIgnoreCase("none") && this.getEmail() == null) {
        raiseError(request, "User", new DomainObjectNotFoundException(UserMeta.getLabelToken()));
        valid = false;
    }
    return valid;
}
Also used : DomainObjectNotFoundException(org.jaffa.exceptions.DomainObjectNotFoundException)

Example 40 with DomainObjectNotFoundException

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

the class UserRequestMaintenanceTx method load.

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

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