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;
}
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);
}
}
}
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
}
Aggregations