Search in sources :

Example 16 with FormDefinition

use of org.jaffa.modules.printing.domain.FormDefinition in project jaffa-framework by jaffa-projects.

the class FormDefinitionMaintenanceTx method load.

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

Example 17 with FormDefinition

use of org.jaffa.modules.printing.domain.FormDefinition in project jaffa-framework by jaffa-projects.

the class FormDefinitionViewerTx method buildDto.

// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private FormDefinitionViewerOutDto buildDto(UOW uow, Collection results) throws UOWException {
    FormDefinitionViewerOutDto output = null;
    Iterator itr = results.iterator();
    if (itr.hasNext()) {
        // just return the details for the 1st record retrieved.
        FormDefinition formDefinition = (FormDefinition) itr.next();
        output = new FormDefinitionViewerOutDto();
        // .//GEN-END:_buildDto_1_be
        // Add custom code before all the setters//GEN-FIRST:_buildDto_1
        // .//GEN-LAST:_buildDto_1
        // .//GEN-BEGIN:_buildDto_FormId_1_be
        output.setFormId(formDefinition.getFormId());
        // .//GEN-END:_buildDto_FormId_1_be
        // .//GEN-BEGIN:_buildDto_FormName_1_be
        output.setFormName(formDefinition.getFormName());
        // .//GEN-END:_buildDto_FormName_1_be
        // .//GEN-BEGIN:_buildDto_FormAlternate_1_be
        output.setFormAlternate(formDefinition.getFormAlternate());
        // .//GEN-END:_buildDto_FormAlternate_1_be
        // .//GEN-BEGIN:_buildDto_FormVariation_1_be
        output.setFormVariation(formDefinition.getFormVariation());
        // .//GEN-END:_buildDto_FormVariation_1_be
        // .//GEN-BEGIN:_buildDto_Description_1_be
        output.setDescription(formDefinition.getDescription());
        // .//GEN-END:_buildDto_Description_1_be
        // .//GEN-BEGIN:_buildDto_Remarks_1_be
        output.setRemarks(formDefinition.getRemarks());
        // .//GEN-END:_buildDto_Remarks_1_be
        // .//GEN-BEGIN:_buildDto_OutputType_1_be
        output.setOutputType(formDefinition.getOutputType());
        // .//GEN-END:_buildDto_OutputType_1_be
        // .//GEN-BEGIN:_buildDto_FollowOnFormName_1_be
        output.setFollowOnFormName(formDefinition.getFollowOnFormName());
        // .//GEN-END:_buildDto_FollowOnFormName_1_be
        // .//GEN-BEGIN:_buildDto_FormTemplate_1_be
        output.setFormTemplate(formDefinition.getFormTemplate());
        // .//GEN-END:_buildDto_FormTemplate_1_be
        // .//GEN-BEGIN:_buildDto_FieldLayout_1_be
        output.setFieldLayout(formDefinition.getFieldLayout());
        // .//GEN-END:_buildDto_FieldLayout_1_be
        // .//GEN-BEGIN:_buildDto_DomClass_1_be
        output.setDomClass(formDefinition.getDomClass());
        // .//GEN-END:_buildDto_DomClass_1_be
        // .//GEN-BEGIN:_buildDto_DomKey1_1_be
        output.setDomKey1(formDefinition.getDomKey1());
        // .//GEN-END:_buildDto_DomKey1_1_be
        // .//GEN-BEGIN:_buildDto_DomKey2_1_be
        output.setDomKey2(formDefinition.getDomKey2());
        // .//GEN-END:_buildDto_DomKey2_1_be
        // .//GEN-BEGIN:_buildDto_DomKey3_1_be
        output.setDomKey3(formDefinition.getDomKey3());
        // .//GEN-END:_buildDto_DomKey3_1_be
        // .//GEN-BEGIN:_buildDto_DomKey4_1_be
        output.setDomKey4(formDefinition.getDomKey4());
        // .//GEN-END:_buildDto_DomKey4_1_be
        // .//GEN-BEGIN:_buildDto_DomKey5_1_be
        output.setDomKey5(formDefinition.getDomKey5());
        // .//GEN-END:_buildDto_DomKey5_1_be
        // .//GEN-BEGIN:_buildDto_DomKey6_1_be
        output.setDomKey6(formDefinition.getDomKey6());
        // .//GEN-END:_buildDto_DomKey6_1_be
        // .//GEN-BEGIN:_buildDto_DomFactory_1_be
        output.setDomFactory(formDefinition.getDomFactory());
        // .//GEN-END:_buildDto_DomFactory_1_be
        // .//GEN-BEGIN:_buildDto_AdditionalDataComponent_1_be
        output.setAdditionalDataComponent(formDefinition.getAdditionalDataComponent());
        // .//GEN-END:_buildDto_AdditionalDataComponent_1_be
        // .//GEN-BEGIN:_buildDto_FollowOnFormAlternate_1_be
        output.setFollowOnFormAlternate(formDefinition.getFollowOnFormAlternate());
        // .//GEN-END:_buildDto_FollowOnFormAlternate_1_be
        // .//GEN-BEGIN:_buildDto_2_be
        // Add related objects, if required
        addRelatedDtos(uow, output, formDefinition);
    // .//GEN-END:_buildDto_2_be
    // Add custom code to pass values to the dto//GEN-FIRST:_buildDto_2
    // .//GEN-LAST:_buildDto_2
    // .//GEN-BEGIN:_buildDto_3_be
    }
    return output;
}
Also used : FormDefinitionViewerOutDto(org.jaffa.modules.printing.components.formdefinitionviewer.dto.FormDefinitionViewerOutDto) FormDefinition(org.jaffa.modules.printing.domain.FormDefinition)

Aggregations

FormDefinition (org.jaffa.modules.printing.domain.FormDefinition)17 ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)9 FrameworkException (org.jaffa.exceptions.FrameworkException)6 ApplicationException (org.jaffa.exceptions.ApplicationException)5 UOW (org.jaffa.persistence.UOW)5 FormTemplate (org.jaffa.modules.printing.domain.FormTemplate)4 Criteria (org.jaffa.persistence.Criteria)4 DomainObjectNotFoundException (org.jaffa.exceptions.DomainObjectNotFoundException)3 InvalidForeignKeyException (org.jaffa.datatypes.exceptions.InvalidForeignKeyException)2 FormUsage (org.jaffa.modules.printing.domain.FormUsage)2 DateTime (org.jaffa.datatypes.DateTime)1 ValidationException (org.jaffa.datatypes.ValidationException)1 DuplicateKeyException (org.jaffa.exceptions.DuplicateKeyException)1 RelatedDomainObjectFoundException (org.jaffa.exceptions.RelatedDomainObjectFoundException)1 FormDefinitionFinderOutDto (org.jaffa.modules.printing.components.formdefinitionfinder.dto.FormDefinitionFinderOutDto)1 FormDefinitionFinderOutRowDto (org.jaffa.modules.printing.components.formdefinitionfinder.dto.FormDefinitionFinderOutRowDto)1 FormDefinitionLookupOutDto (org.jaffa.modules.printing.components.formdefinitionlookup.dto.FormDefinitionLookupOutDto)1 FormDefinitionLookupOutRowDto (org.jaffa.modules.printing.components.formdefinitionlookup.dto.FormDefinitionLookupOutRowDto)1 FormDefinitionViewerOutDto (org.jaffa.modules.printing.components.formdefinitionviewer.dto.FormDefinitionViewerOutDto)1 FormSelectionMaintenanceOutDto (org.jaffa.modules.printing.components.formselectionmaintenance.dto.FormSelectionMaintenanceOutDto)1