Search in sources :

Example 1 with ICodeHelper

use of org.jaffa.components.codehelper.ICodeHelper in project jaffa-framework by jaffa-projects.

the class CallBackDropdownHelper method getOptions.

public CodeHelperOutElementDto getOptions(HttpServletRequest request, String returnField, String descField, String domainName, CriteriaElementDto[] criteriaFields) throws ApplicationExceptions, FrameworkException {
    CodeHelperOutElementDto m_dropDownCodes = null;
    ApplicationExceptions appExps = null;
    CodeHelperInDto input = null;
    System.out.println("Still alive1");
    if (m_codeHelperTx == null)
        m_codeHelperTx = (ICodeHelper) Factory.createObject(ICodeHelper.class);
    if (m_dropDownCodes == null) {
        if (input == null)
            input = new CodeHelperInDto();
        CodeHelperInElementDto codeHelperInElementDto = new CodeHelperInElementDto();
        codeHelperInElementDto.setCode("sort");
        codeHelperInElementDto.setDomainClassName(domainName);
        codeHelperInElementDto.setCodeFieldName(returnField);
        codeHelperInElementDto.setDescriptionFieldName(descField);
        for (int i = 0; i < criteriaFields.length; i++) {
            CriteriaElementDto criteriaField = criteriaFields[i];
            codeHelperInElementDto.addCriteriaField(criteriaField);
        }
        input.addCodeHelperInElementDto(codeHelperInElementDto);
    }
    // throw ApplicationExceptions, if any parsing errors occured
    if (appExps != null && appExps.size() > 0)
        throw appExps;
    // Get the Codes and populate the respective fields
    if (input != null) {
        System.out.println("Still alive2");
        input.setHeaderDto(getHeaderDto(request));
        System.out.println("Still alive3");
        CodeHelperOutDto output = m_codeHelperTx.getCodes(input);
        if (output != null && output.getCodeHelperOutElementDtoCount() > 0) {
            CodeHelperOutElementDto[] codeHelperOutElementDtos = output.getCodeHelperOutElementDtos();
            for (int i = 0; i < codeHelperOutElementDtos.length; i++) {
                CodeHelperOutElementDto codeHelperOutElementDto = codeHelperOutElementDtos[i];
                String code = codeHelperOutElementDto.getCode();
                if (code.equals("sort"))
                    m_dropDownCodes = codeHelperOutElementDto;
            }
        }
    }
    System.out.println("Still alive4");
    return m_dropDownCodes;
}
Also used : CodeHelperInDto(org.jaffa.components.codehelper.dto.CodeHelperInDto) ICodeHelper(org.jaffa.components.codehelper.ICodeHelper) CodeHelperInElementDto(org.jaffa.components.codehelper.dto.CodeHelperInElementDto) ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) CriteriaElementDto(org.jaffa.components.codehelper.dto.CriteriaElementDto) CodeHelperOutDto(org.jaffa.components.codehelper.dto.CodeHelperOutDto) CodeHelperOutElementDto(org.jaffa.components.codehelper.dto.CodeHelperOutElementDto)

Example 2 with ICodeHelper

use of org.jaffa.components.codehelper.ICodeHelper in project jaffa-framework by jaffa-projects.

the class UserTimeEntryMaintenanceComponent method initDropDownCodes.

// .//GEN-END:_doPrevalidateUpdate_3_be
// .//GEN-BEGIN:_initDropDownCodes_1_be
/**
 * This will retrieve the set of codes for dropdowns, if any are required
 */
protected void initDropDownCodes() throws ApplicationExceptions, FrameworkException {
    ApplicationExceptions appExps = null;
    CodeHelperInDto input = null;
    if (m_codeHelperTx == null)
        m_codeHelperTx = (ICodeHelper) Factory.createObject(ICodeHelper.class);
    if (m_projectCodeCodes == null) {
        if (input == null)
            input = new CodeHelperInDto();
        CodeHelperInElementDto codeHelperInElementDto = new CodeHelperInElementDto();
        codeHelperInElementDto.setCode("projectCode");
        codeHelperInElementDto.setDomainClassName("org.jaffa.applications.test.modules.time.domain.ProjectCode");
        codeHelperInElementDto.setCodeFieldName("ProjectCode");
        codeHelperInElementDto.setDescriptionFieldName("Description");
        input.addCodeHelperInElementDto(codeHelperInElementDto);
    }
    // throw ApplicationExceptions, if any parsing errors occured
    if (appExps != null && appExps.size() > 0)
        throw appExps;
    // Get the Codes and populate the respective fields
    if (input != null) {
        input.setHeaderDto(getHeaderDto());
        CodeHelperOutDto output = m_codeHelperTx.getCodes(input);
        if (output != null && output.getCodeHelperOutElementDtoCount() > 0) {
            CodeHelperOutElementDto[] codeHelperOutElementDtos = output.getCodeHelperOutElementDtos();
            for (int i = 0; i < codeHelperOutElementDtos.length; i++) {
                CodeHelperOutElementDto codeHelperOutElementDto = codeHelperOutElementDtos[i];
                String code = codeHelperOutElementDto.getCode();
                if (code.equals("projectCode"))
                    m_projectCodeCodes = codeHelperOutElementDto;
            }
        }
    }
}
Also used : ICodeHelper(org.jaffa.components.codehelper.ICodeHelper) ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) org.jaffa.components.maint(org.jaffa.components.maint)

Example 3 with ICodeHelper

use of org.jaffa.components.codehelper.ICodeHelper in project jaffa-framework by jaffa-projects.

the class PrinterDefinitionFinderComponent method initializeCriteriaScreen.

// .//GEN-END:_addListeners_1_be
// .//GEN-BEGIN:_initializeCriteriaScreen_1_be
/**
 * This will retrieve the set of codes for dropdowns, if any are required
 * @throws ApplicationExceptions This will be thrown in case any invalid data has been set.
 * @throws FrameworkException Indicates some system error.
 */
protected void initializeCriteriaScreen() throws ApplicationExceptions, FrameworkException {
    ApplicationExceptions appExps = null;
    CodeHelperInDto input = null;
    if (m_codeHelperTx == null)
        m_codeHelperTx = (ICodeHelper) Factory.createObject(ICodeHelper.class);
    if (m_outputTypeCodes == null) {
        if (input == null)
            input = new CodeHelperInDto();
        CodeHelperInElementDto codeHelperInElementDto = new CodeHelperInElementDto();
        codeHelperInElementDto.setCode("outputType");
        codeHelperInElementDto.setDomainClassName("org.jaffa.modules.printing.domain.PrinterOutputType");
        codeHelperInElementDto.setCodeFieldName("OutputType");
        codeHelperInElementDto.setDescriptionFieldName("Description");
        codeHelperInElementDto.setAppendCodeAndDescription(true);
        input.addCodeHelperInElementDto(codeHelperInElementDto);
    }
    // throw ApplicationExceptions, if any parsing errors occured
    if (appExps != null && appExps.size() > 0)
        throw appExps;
    // Get the Codes and populate the respective fields
    if (input != null) {
        input.setHeaderDto(getHeaderDto());
        CodeHelperOutDto output = m_codeHelperTx.getCodes(input);
        if (output != null && output.getCodeHelperOutElementDtoCount() > 0) {
            CodeHelperOutElementDto[] codeHelperOutElementDtos = output.getCodeHelperOutElementDtos();
            for (int i = 0; i < codeHelperOutElementDtos.length; i++) {
                CodeHelperOutElementDto codeHelperOutElementDto = codeHelperOutElementDtos[i];
                String code = codeHelperOutElementDto.getCode();
                if (code.equals("outputType"))
                    m_outputTypeCodes = codeHelperOutElementDto;
            }
        }
    }
    // Get comma-separated page size business rule and create drop-down list,
    // if scaleToPageSizes business rule is defined. e.g. scaleToPageSizes=LETTER,A4
    CodeHelperOutElementDto codeHelperOutElementDto;
    CodeHelperOutCodeDto codeHelperOutCodeDto;
    if (scaleToPageSizesArray == null) {
        String scaleToPageSizesRule = (String) ContextManagerFactory.instance().getProperty("jaffa.printing.scaleToPageSizes");
        scaleToPageSizesArray = scaleToPageSizesRule != null ? scaleToPageSizesRule.split(",") : null;
        codeHelperOutElementDto = new CodeHelperOutElementDto();
        if (scaleToPageSizesArray != null) {
            for (String size : scaleToPageSizesArray) {
                codeHelperOutCodeDto = new CodeHelperOutCodeDto();
                codeHelperOutCodeDto.setCode(size);
                codeHelperOutCodeDto.setDescription(size);
                codeHelperOutElementDto.addCodeHelperOutCodeDto(codeHelperOutCodeDto);
            }
            m_scaleToPageSizeCodes = codeHelperOutElementDto;
        }
    }
}
Also used : ICodeHelper(org.jaffa.components.codehelper.ICodeHelper) ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) org.jaffa.components.maint(org.jaffa.components.maint)

Example 4 with ICodeHelper

use of org.jaffa.components.codehelper.ICodeHelper in project jaffa-framework by jaffa-projects.

the class PrinterDefinitionLookupComponent method initializeCriteriaScreen.

// .//GEN-END:_addListeners_1_be
// .//GEN-BEGIN:_initializeCriteriaScreen_1_be
/**
 * This will retrieve the set of codes for dropdowns, if any are required
 * @throws ApplicationExceptions This will be thrown in case any invalid data has been set.
 * @throws FrameworkException Indicates some system error.
 */
protected void initializeCriteriaScreen() throws ApplicationExceptions, FrameworkException {
    ApplicationExceptions appExps = null;
    CodeHelperInDto input = null;
    if (m_codeHelperTx == null)
        m_codeHelperTx = (ICodeHelper) Factory.createObject(ICodeHelper.class);
    if (m_outputTypeCodes == null) {
        if (input == null)
            input = new CodeHelperInDto();
        CodeHelperInElementDto codeHelperInElementDto = new CodeHelperInElementDto();
        codeHelperInElementDto.setCode("outputType");
        codeHelperInElementDto.setDomainClassName("org.jaffa.modules.printing.domain.PrinterOutputType");
        codeHelperInElementDto.setCodeFieldName("OutputType");
        codeHelperInElementDto.setDescriptionFieldName("Description");
        codeHelperInElementDto.setAppendCodeAndDescription(true);
        input.addCodeHelperInElementDto(codeHelperInElementDto);
    }
    // throw ApplicationExceptions, if any parsing errors occured
    if (appExps != null && appExps.size() > 0)
        throw appExps;
    // Get the Codes and populate the respective fields
    if (input != null) {
        input.setHeaderDto(getHeaderDto());
        CodeHelperOutDto output = m_codeHelperTx.getCodes(input);
        if (output != null && output.getCodeHelperOutElementDtoCount() > 0) {
            CodeHelperOutElementDto[] codeHelperOutElementDtos = output.getCodeHelperOutElementDtos();
            for (int i = 0; i < codeHelperOutElementDtos.length; i++) {
                CodeHelperOutElementDto codeHelperOutElementDto = codeHelperOutElementDtos[i];
                String code = codeHelperOutElementDto.getCode();
                if (code.equals("outputType"))
                    m_outputTypeCodes = codeHelperOutElementDto;
            }
        }
    }
    // Get comma-separated page size business rule and create drop-down list,
    // if scaleToPageSizes business rule is defined. e.g. scaleToPageSizes=LETTER,A4
    CodeHelperOutElementDto codeHelperOutElementDto;
    CodeHelperOutCodeDto codeHelperOutCodeDto;
    if (scaleToPageSizesArray == null) {
        String scaleToPageSizesRule = (String) ContextManagerFactory.instance().getProperty("jaffa.printing.scaleToPageSizes");
        scaleToPageSizesArray = scaleToPageSizesRule != null ? scaleToPageSizesRule.split(",") : null;
        codeHelperOutElementDto = new CodeHelperOutElementDto();
        if (scaleToPageSizesArray != null) {
            for (String size : scaleToPageSizesArray) {
                codeHelperOutCodeDto = new CodeHelperOutCodeDto();
                codeHelperOutCodeDto.setCode(size);
                codeHelperOutCodeDto.setDescription(size);
                codeHelperOutElementDto.addCodeHelperOutCodeDto(codeHelperOutCodeDto);
            }
            m_scaleToPageSizeCodes = codeHelperOutElementDto;
        }
    }
}
Also used : ICodeHelper(org.jaffa.components.codehelper.ICodeHelper) ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) org.jaffa.components.maint(org.jaffa.components.maint)

Example 5 with ICodeHelper

use of org.jaffa.components.codehelper.ICodeHelper in project jaffa-framework by jaffa-projects.

the class PrinterDefinitionMaintenanceComponent method initDropDownCodes.

// .//GEN-END:_doPrevalidateUpdate_3_be
// .//GEN-BEGIN:_initDropDownCodes_1_be
/**
 * This will retrieve the set of codes for dropdowns, if any are required
 */
protected void initDropDownCodes() throws ApplicationExceptions, FrameworkException {
    ApplicationExceptions appExps = null;
    CodeHelperInDto input = null;
    if (m_codeHelperTx == null)
        m_codeHelperTx = (ICodeHelper) Factory.createObject(ICodeHelper.class);
    if (m_outputTypeCodes == null) {
        if (input == null)
            input = new CodeHelperInDto();
        CodeHelperInElementDto codeHelperInElementDto = new CodeHelperInElementDto();
        codeHelperInElementDto.setCode("outputType");
        codeHelperInElementDto.setDomainClassName("org.jaffa.modules.printing.domain.PrinterOutputType");
        codeHelperInElementDto.setCodeFieldName("OutputType");
        codeHelperInElementDto.setDescriptionFieldName("OutputType");
        input.addCodeHelperInElementDto(codeHelperInElementDto);
    }
    // throw ApplicationExceptions, if any parsing errors occured
    if (appExps != null && appExps.size() > 0)
        throw appExps;
    // Get the Codes and populate the respective fields
    if (input != null) {
        input.setHeaderDto(getHeaderDto());
        CodeHelperOutDto output = m_codeHelperTx.getCodes(input);
        if (output != null && output.getCodeHelperOutElementDtoCount() > 0) {
            CodeHelperOutElementDto[] codeHelperOutElementDtos = output.getCodeHelperOutElementDtos();
            for (int i = 0; i < codeHelperOutElementDtos.length; i++) {
                CodeHelperOutElementDto codeHelperOutElementDto = codeHelperOutElementDtos[i];
                String code = codeHelperOutElementDto.getCode();
                if (code.equals("outputType"))
                    m_outputTypeCodes = codeHelperOutElementDto;
            }
        }
    }
    // Get comma-separated page size business rule and create drop-down list,
    // if scaleToPageSizes business rule is defined. e.g. scaleToPageSizes=LETTER,A4
    CodeHelperOutElementDto codeHelperOutElementDto;
    CodeHelperOutCodeDto codeHelperOutCodeDto;
    if (scaleToPageSizesArray == null) {
        String scaleToPageSizesRule = (String) ContextManagerFactory.instance().getProperty("jaffa.printing.scaleToPageSizes");
        scaleToPageSizesArray = scaleToPageSizesRule != null ? scaleToPageSizesRule.split(",") : null;
        codeHelperOutElementDto = new CodeHelperOutElementDto();
        if (scaleToPageSizesArray != null) {
            for (String size : scaleToPageSizesArray) {
                codeHelperOutCodeDto = new CodeHelperOutCodeDto();
                codeHelperOutCodeDto.setCode(size);
                codeHelperOutCodeDto.setDescription(size);
                codeHelperOutElementDto.addCodeHelperOutCodeDto(codeHelperOutCodeDto);
            }
            m_scaleToPageSizeCodes = codeHelperOutElementDto;
        }
    }
}
Also used : ICodeHelper(org.jaffa.components.codehelper.ICodeHelper) ApplicationExceptions(org.jaffa.exceptions.ApplicationExceptions) org.jaffa.components.maint(org.jaffa.components.maint)

Aggregations

ICodeHelper (org.jaffa.components.codehelper.ICodeHelper)5 ApplicationExceptions (org.jaffa.exceptions.ApplicationExceptions)5 org.jaffa.components.maint (org.jaffa.components.maint)4 CodeHelperInDto (org.jaffa.components.codehelper.dto.CodeHelperInDto)1 CodeHelperInElementDto (org.jaffa.components.codehelper.dto.CodeHelperInElementDto)1 CodeHelperOutDto (org.jaffa.components.codehelper.dto.CodeHelperOutDto)1 CodeHelperOutElementDto (org.jaffa.components.codehelper.dto.CodeHelperOutElementDto)1 CriteriaElementDto (org.jaffa.components.codehelper.dto.CriteriaElementDto)1