Search in sources :

Example 16 with OutputCommand

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

the class OutputCommandViewerTx method buildDto.

// .//GEN-END:_buildCriteria_3_be
// .//GEN-BEGIN:_buildDto_1_be
private OutputCommandViewerOutDto buildDto(UOW uow, Collection results) throws UOWException {
    OutputCommandViewerOutDto output = null;
    Iterator itr = results.iterator();
    if (itr.hasNext()) {
        // just return the details for the 1st record retrieved.
        OutputCommand outputCommand = (OutputCommand) itr.next();
        output = new OutputCommandViewerOutDto();
        // .//GEN-END:_buildDto_1_be
        // Add custom code before all the setters //GEN-FIRST:_buildDto_1
        // .//GEN-LAST:_buildDto_1
        // .//GEN-BEGIN:_buildDto_OutputCommandId_1_be
        output.setOutputCommandId(outputCommand.getOutputCommandId());
        // .//GEN-END:_buildDto_OutputCommandId_1_be
        // .//GEN-BEGIN:_buildDto_OutputType_1_be
        output.setOutputType(outputCommand.getOutputType());
        // .//GEN-END:_buildDto_OutputType_1_be
        // .//GEN-BEGIN:_buildDto_SequenceNo_1_be
        output.setSequenceNo(outputCommand.getSequenceNo());
        // .//GEN-END:_buildDto_SequenceNo_1_be
        // .//GEN-BEGIN:_buildDto_OsPattern_1_be
        output.setOsPattern(outputCommand.getOsPattern());
        // .//GEN-END:_buildDto_OsPattern_1_be
        // .//GEN-BEGIN:_buildDto_CommandLine_1_be
        output.setCommandLine(outputCommand.getCommandLine());
        // .//GEN-END:_buildDto_CommandLine_1_be
        // .//GEN-BEGIN:_buildDto_CreatedOn_1_be
        output.setCreatedOn(outputCommand.getCreatedOn());
        // .//GEN-END:_buildDto_CreatedOn_1_be
        // .//GEN-BEGIN:_buildDto_CreatedBy_1_be
        output.setCreatedBy(outputCommand.getCreatedBy());
        // .//GEN-END:_buildDto_CreatedBy_1_be
        // .//GEN-BEGIN:_buildDto_LastChangedOn_1_be
        output.setLastChangedOn(outputCommand.getLastChangedOn());
        // .//GEN-END:_buildDto_LastChangedOn_1_be
        // .//GEN-BEGIN:_buildDto_LastChangedBy_1_be
        output.setLastChangedBy(outputCommand.getLastChangedBy());
        // .//GEN-END:_buildDto_LastChangedBy_1_be
        // .//GEN-BEGIN:_buildDto_2_be
        // Add related objects, if required
        addRelatedDtos(uow, output, outputCommand);
    // .//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 : OutputCommand(org.jaffa.modules.printing.domain.OutputCommand) OutputCommandViewerOutDto(org.jaffa.modules.printing.components.outputcommandviewer.dto.OutputCommandViewerOutDto)

Example 17 with OutputCommand

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

the class PrinterOutputTypeMaintenanceTx method addRelatedDtosToRetrieveOut.

// .//GEN-END:_createPrevalidateOutDto_2_be
// .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_1_be
/**
 * Add related objects to PrinterOutputTypeMaintenanceRetrieveOutDto
 */
private void addRelatedDtosToRetrieveOut(UOW uow, PrinterOutputType printerOutputType, PrinterOutputTypeMaintenanceRetrieveOutDto output) throws FrameworkException, ApplicationExceptions {
    // .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_OutputCommand_1_be
    if (printerOutputType.getOutputType() != null) {
        Criteria criteria = new Criteria();
        criteria.setTable(OutputCommandMeta.getName());
        criteria.addCriteria(OutputCommandMeta.OUTPUT_TYPE, printerOutputType.getOutputType());
        criteria.addOrderBy("SequenceNo", Criteria.ORDER_BY_ASC);
        // .//GEN-END:_addRelatedDtosToRetrieveOut_OutputCommand_1_be
        // Add custom code to set the criteria before the query //GEN-FIRST:_addRelatedDtosToRetrieveOut_OutputCommand_1
        // .//GEN-LAST:_addRelatedDtosToRetrieveOut_OutputCommand_1
        // .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_OutputCommand_2_be
        Iterator itrMany = uow.query(criteria).iterator();
        while (itrMany.hasNext()) {
            OutputCommand outputCommand = (OutputCommand) itrMany.next();
            OutputCommandDto dto = new OutputCommandDto();
            // .//GEN-END:_addRelatedDtosToRetrieveOut_OutputCommand_2_be
            // Add custom code before all the setters //GEN-FIRST:_addRelatedDtosToRetrieveOut_OutputCommand_2
            // .//GEN-LAST:_addRelatedDtosToRetrieveOut_OutputCommand_2
            // .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_OutputCommand_OutputCommandId_1_be
            dto.setOutputCommandId(outputCommand.getOutputCommandId());
            // .//GEN-END:_addRelatedDtosToRetrieveOut_OutputCommand_OutputCommandId_1_be
            // .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_OutputCommand_OutputType_1_be
            dto.setOutputType(outputCommand.getOutputType());
            // .//GEN-END:_addRelatedDtosToRetrieveOut_OutputCommand_OutputType_1_be
            // .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_OutputCommand_SequenceNo_1_be
            dto.setSequenceNo(outputCommand.getSequenceNo());
            // .//GEN-END:_addRelatedDtosToRetrieveOut_OutputCommand_SequenceNo_1_be
            // .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_OutputCommand_OsPattern_1_be
            dto.setOsPattern(outputCommand.getOsPattern());
            // .//GEN-END:_addRelatedDtosToRetrieveOut_OutputCommand_OsPattern_1_be
            // .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_OutputCommand_CommandLine_1_be
            dto.setCommandLine(outputCommand.getCommandLine());
            // .//GEN-END:_addRelatedDtosToRetrieveOut_OutputCommand_CommandLine_1_be
            // .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_OutputCommand_CreatedOn_1_be
            dto.setCreatedOn(outputCommand.getCreatedOn());
            // .//GEN-END:_addRelatedDtosToRetrieveOut_OutputCommand_CreatedOn_1_be
            // .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_OutputCommand_CreatedBy_1_be
            dto.setCreatedBy(outputCommand.getCreatedBy());
            // .//GEN-END:_addRelatedDtosToRetrieveOut_OutputCommand_CreatedBy_1_be
            // .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_OutputCommand_LastChangedOn_1_be
            dto.setLastChangedOn(outputCommand.getLastChangedOn());
            // .//GEN-END:_addRelatedDtosToRetrieveOut_OutputCommand_LastChangedOn_1_be
            // .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_OutputCommand_LastChangedBy_1_be
            dto.setLastChangedBy(outputCommand.getLastChangedBy());
            // .//GEN-END:_addRelatedDtosToRetrieveOut_OutputCommand_LastChangedBy_1_be
            // Add custom code to pass values to the dto //GEN-FIRST:_addRelatedDtosToRetrieveOut_OutputCommand_3
            // .//GEN-LAST:_addRelatedDtosToRetrieveOut_OutputCommand_3
            // .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_OutputCommand_3_be
            output.addOutputCommand(dto);
        }
    // .//GEN-END:_addRelatedDtosToRetrieveOut_OutputCommand_3_be
    // .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_OutputCommand_6_be
    }
// .//GEN-END:_addRelatedDtosToRetrieveOut_OutputCommand_6_be
// .//GEN-BEGIN:_addRelatedDtosToRetrieveOut_2_be
}
Also used : OutputCommand(org.jaffa.modules.printing.domain.OutputCommand) Criteria(org.jaffa.persistence.Criteria)

Example 18 with OutputCommand

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

the class PrinterOutputType 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 {
    OutputCommand[] outputCommandArray = null;
    try {
        outputCommandArray = getOutputCommandArray();
    } catch (FrameworkException e) {
        throw new PreDeleteFailedException(null, e);
    }
    if (outputCommandArray != null && outputCommandArray.length > 0) {
        try {
            // Perform cascade deletes
            for (int i = 0; i < outputCommandArray.length; i++) getUOW().delete(outputCommandArray[i]);
        } catch (Exception e) {
            throw new PreDeleteFailedException(null, e);
        }
    }
    PrinterDefinition[] printerDefinitionArray = null;
    try {
        printerDefinitionArray = getPrinterDefinitionArray();
    } catch (FrameworkException e) {
        throw new PreDeleteFailedException(null, e);
    }
    if (printerDefinitionArray != null && printerDefinitionArray.length > 0) {
        // Stop the deletion !!
        throw new PreDeleteFailedException(null, new RelatedDomainObjectFoundException(PrinterDefinitionMeta.getLabelToken()));
    }
}
Also used : PrinterDefinition(org.jaffa.modules.printing.domain.PrinterDefinition) FrameworkException(org.jaffa.exceptions.FrameworkException) OutputCommand(org.jaffa.modules.printing.domain.OutputCommand) 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)

Example 19 with OutputCommand

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

the class PrinterOutputType method newOutputCommandObject.

/**
 * Creates a new OutputCommand object and initializes the related fields.
 * This will uncache the related OutputCommand objects.
 * @throws ValidationException if an invalid value is passed.
 * @throws FrameworkException Indicates some system error
 * @return the related OutputCommand object with the initialized related fields.
 */
public OutputCommand newOutputCommandObject() throws ValidationException, FrameworkException {
    m_outputCommandCollection = null;
    OutputCommand outputCommand = new OutputCommand();
    outputCommand.setOutputType(getOutputType());
    // .//GEN-BEGIN:outputCommandArray_3_be
    return outputCommand;
}
Also used : OutputCommand(org.jaffa.modules.printing.domain.OutputCommand)

Aggregations

OutputCommand (org.jaffa.modules.printing.domain.OutputCommand)19 ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)11 ApplicationException (org.jaffa.exceptions.ApplicationException)6 FrameworkException (org.jaffa.exceptions.FrameworkException)6 Criteria (org.jaffa.persistence.Criteria)6 UOW (org.jaffa.persistence.UOW)6 DomainObjectNotFoundException (org.jaffa.exceptions.DomainObjectNotFoundException)4 PrinterDefinition (org.jaffa.modules.printing.domain.PrinterDefinition)2 ValidationException (org.jaffa.datatypes.ValidationException)1 InvalidForeignKeyException (org.jaffa.datatypes.exceptions.InvalidForeignKeyException)1 DuplicateKeyException (org.jaffa.exceptions.DuplicateKeyException)1 RelatedDomainObjectFoundException (org.jaffa.exceptions.RelatedDomainObjectFoundException)1 OutputCommandFinderOutDto (org.jaffa.modules.printing.components.outputcommandfinder.dto.OutputCommandFinderOutDto)1 OutputCommandFinderOutRowDto (org.jaffa.modules.printing.components.outputcommandfinder.dto.OutputCommandFinderOutRowDto)1 OutputCommandLookupOutDto (org.jaffa.modules.printing.components.outputcommandlookup.dto.OutputCommandLookupOutDto)1 OutputCommandLookupOutRowDto (org.jaffa.modules.printing.components.outputcommandlookup.dto.OutputCommandLookupOutRowDto)1 OutputCommandViewerOutDto (org.jaffa.modules.printing.components.outputcommandviewer.dto.OutputCommandViewerOutDto)1 org.jaffa.modules.printing.components.printeroutputtypemaintenance.dto (org.jaffa.modules.printing.components.printeroutputtypemaintenance.dto)1 OutputCommandDto (org.jaffa.modules.printing.components.printeroutputtypeviewer.dto.OutputCommandDto)1 PrinterOutputType (org.jaffa.modules.printing.domain.PrinterOutputType)1