Search in sources :

Example 21 with FormUsage

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

the class FormUsageViewerTx method buildDto.

// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private FormUsageViewerOutDto buildDto(UOW uow, Collection results) throws UOWException {
    FormUsageViewerOutDto output = null;
    Iterator itr = results.iterator();
    if (itr.hasNext()) {
        // just return the details for the 1st record retrieved.
        FormUsage formUsage = (FormUsage) itr.next();
        output = new FormUsageViewerOutDto();
        // .//GEN-END:_buildDto_1_be
        // Add custom code before all the setters //GEN-FIRST:_buildDto_1
        // .//GEN-LAST:_buildDto_1
        // .//GEN-BEGIN:_buildDto_FormName_1_be
        output.setFormName(formUsage.getFormName());
        // .//GEN-END:_buildDto_FormName_1_be
        // .//GEN-BEGIN:_buildDto_EventName_1_be
        output.setEventName(formUsage.getEventName());
        // .//GEN-END:_buildDto_EventName_1_be
        // .//GEN-BEGIN:_buildDto_FormAlternate_1_be
        output.setFormAlternate(formUsage.getFormAlternate());
        // .//GEN-END:_buildDto_FormAlternate_1_be
        // .//GEN-BEGIN:_buildDto_Copies_1_be
        output.setCopies(formUsage.getCopies());
        // .//GEN-END:_buildDto_Copies_1_be
        // .//GEN-BEGIN:_buildDto_CreatedOn_1_be
        output.setCreatedOn(formUsage.getCreatedOn());
        // .//GEN-END:_buildDto_CreatedOn_1_be
        // .//GEN-BEGIN:_buildDto_CreatedBy_1_be
        output.setCreatedBy(formUsage.getCreatedBy());
        // .//GEN-END:_buildDto_CreatedBy_1_be
        // .//GEN-BEGIN:_buildDto_LastChangedOn_1_be
        output.setLastChangedOn(formUsage.getLastChangedOn());
        // .//GEN-END:_buildDto_LastChangedOn_1_be
        // .//GEN-BEGIN:_buildDto_LastChangedBy_1_be
        output.setLastChangedBy(formUsage.getLastChangedBy());
        // .//GEN-END:_buildDto_LastChangedBy_1_be
        // .//GEN-BEGIN:_buildDto_2_be
        // Add related objects, if required
        addRelatedDtos(uow, output, formUsage);
    // .//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 : FormUsageViewerOutDto(org.jaffa.modules.printing.components.formusageviewer.dto.FormUsageViewerOutDto) FormUsage(org.jaffa.modules.printing.domain.FormUsage)

Example 22 with FormUsage

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

the class FormGroup method performPreDeleteReferentialIntegrity.

// .//GEN-END:performForeignKeyValidations_1_be
// .//GEN-BEGIN:performPreDeleteReferentialIntegrity_1_be
/**
 * This method is triggered by the UOW, before adding this object to the Delete-Store.
 * This will raise an exception if any associated/aggregated objects exist.
 * This will cascade delete all composite objects.
 * @throws PreDeleteFailedException if any error occurs during the process.
 */
public void performPreDeleteReferentialIntegrity() throws PreDeleteFailedException {
    FormUsage[] formUsageArray = null;
    try {
        formUsageArray = getFormUsageArray();
    } catch (FrameworkException e) {
        throw new PreDeleteFailedException(null, e);
    }
    if (formUsageArray != null && formUsageArray.length > 0) {
        // Stop the deletion !!
        throw new PreDeleteFailedException(null, new RelatedDomainObjectFoundException(FormUsageMeta.getLabelToken()));
    }
    FormDefinition[] formDefinitionArray = null;
    try {
        formDefinitionArray = getFormDefinitionArray();
    } catch (FrameworkException e) {
        throw new PreDeleteFailedException(null, e);
    }
    if (formDefinitionArray != null && formDefinitionArray.length > 0) {
        try {
            // Perform cascade deletes
            for (int i = 0; i < formDefinitionArray.length; i++) getUOW().delete(formDefinitionArray[i]);
        } catch (Exception e) {
            throw new PreDeleteFailedException(null, e);
        }
    }
}
Also used : FrameworkException(org.jaffa.exceptions.FrameworkException) FormDefinition(org.jaffa.modules.printing.domain.FormDefinition) RelatedDomainObjectFoundException(org.jaffa.exceptions.RelatedDomainObjectFoundException) FrameworkException(org.jaffa.exceptions.FrameworkException) InvalidForeignKeyException(org.jaffa.datatypes.exceptions.InvalidForeignKeyException) DuplicateKeyException(org.jaffa.exceptions.DuplicateKeyException) RelatedDomainObjectFoundException(org.jaffa.exceptions.RelatedDomainObjectFoundException) FormUsage(org.jaffa.modules.printing.domain.FormUsage)

Example 23 with FormUsage

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

the class FormEventMaintenanceTx method addRelatedDtosToRetrieveOut.

// .//GEN-END:_createPrevalidateOutDto_2_be
// .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_1_be
/**
 * Add related objects to FormEventMaintenanceRetrieveOutDto
 */
private void addRelatedDtosToRetrieveOut(UOW uow, FormEvent formEvent, FormEventMaintenanceRetrieveOutDto output) throws FrameworkException, ApplicationExceptions {
    // .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_FormUsage_1_be
    if (formEvent.getEventName() != null) {
        Criteria criteria = new Criteria();
        criteria.setTable(FormUsageMeta.getName());
        criteria.addCriteria(FormUsageMeta.EVENT_NAME, formEvent.getEventName());
        // .//GEN-END:_addRelatedDtosToRetrieveOut_FormUsage_1_be
        // Add custom code to set the criteria before the query//GEN-FIRST:_addRelatedDtosToRetrieveOut_FormUsage_1
        // .//GEN-LAST:_addRelatedDtosToRetrieveOut_FormUsage_1
        // .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_FormUsage_2_be
        Iterator itrMany = uow.query(criteria).iterator();
        while (itrMany.hasNext()) {
            FormUsage formUsage = (FormUsage) itrMany.next();
            FormUsageDto dto = new FormUsageDto();
            // .//GEN-END:_addRelatedDtosToRetrieveOut_FormUsage_2_be
            // Add custom code before all the setters//GEN-FIRST:_addRelatedDtosToRetrieveOut_FormUsage_2
            // .//GEN-LAST:_addRelatedDtosToRetrieveOut_FormUsage_2
            // .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_FormUsage_EventName_1_be
            dto.setEventName(formUsage.getEventName());
            // .//GEN-END:_addRelatedDtosToRetrieveOut_FormUsage_EventName_1_be
            // Add custom code to pass values to the dto//GEN-FIRST:_addRelatedDtosToRetrieveOut_FormUsage_3
            // .//GEN-LAST:_addRelatedDtosToRetrieveOut_FormUsage_3
            // .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_FormUsage_3_be
            output.addFormUsage(dto);
        }
    // .//GEN-END:_addRelatedDtosToRetrieveOut_FormUsage_3_be
    // .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_FormUsage_6_be
    }
// .//GEN-END:_addRelatedDtosToRetrieveOut_FormUsage_6_be
// .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_2_be
}
Also used : Criteria(org.jaffa.persistence.Criteria) FormUsage(org.jaffa.modules.printing.domain.FormUsage)

Aggregations

FormUsage (org.jaffa.modules.printing.domain.FormUsage)23 ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)10 Criteria (org.jaffa.persistence.Criteria)9 FrameworkException (org.jaffa.exceptions.FrameworkException)6 ApplicationException (org.jaffa.exceptions.ApplicationException)5 UOW (org.jaffa.persistence.UOW)5 DomainObjectNotFoundException (org.jaffa.exceptions.DomainObjectNotFoundException)3 ValidationException (org.jaffa.datatypes.ValidationException)2 FormSelectionMaintenanceOutDto (org.jaffa.modules.printing.components.formselectionmaintenance.dto.FormSelectionMaintenanceOutDto)2 FormSelectionMaintenanceOutRowDto (org.jaffa.modules.printing.components.formselectionmaintenance.dto.FormSelectionMaintenanceOutRowDto)2 FormDefinition (org.jaffa.modules.printing.domain.FormDefinition)2 FormEvent (org.jaffa.modules.printing.domain.FormEvent)2 DateTime (org.jaffa.datatypes.DateTime)1 InvalidForeignKeyException (org.jaffa.datatypes.exceptions.InvalidForeignKeyException)1 DuplicateKeyException (org.jaffa.exceptions.DuplicateKeyException)1 RelatedDomainObjectFoundException (org.jaffa.exceptions.RelatedDomainObjectFoundException)1 FormUsageDto (org.jaffa.modules.printing.components.formeventviewer.dto.FormUsageDto)1 FormUsageDto (org.jaffa.modules.printing.components.formgroupviewer.dto.FormUsageDto)1 FormUsageFinderOutDto (org.jaffa.modules.printing.components.formusagefinder.dto.FormUsageFinderOutDto)1 FormUsageFinderOutRowDto (org.jaffa.modules.printing.components.formusagefinder.dto.FormUsageFinderOutRowDto)1