use of org.jaffa.components.codehelper.dto.CodeHelperOutDto 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;
}
use of org.jaffa.components.codehelper.dto.CodeHelperOutDto in project jaffa-framework by jaffa-projects.
the class CodeHelperTx method getCodes.
/**
* Retrieves the Codes for the specified domainClassName passed in the input.
* @param input The input dto, containing a list of domainClass to retrieve.
* @return The Codes for each domainClassName passed in the input.
* @throws ApplicationExceptions This will be thrown if any invalid data is passed.
* @throws FrameworkException Indicates some system error.
*/
public CodeHelperOutDto getCodes(CodeHelperInDto input) throws ApplicationExceptions, FrameworkException {
UOW uow = null;
try {
// Print Debug Information for the input
if (log.isDebugEnabled()) {
log.debug("Input: " + (input != null ? input.toString() : null));
}
// Create the output
CodeHelperOutDto output = new CodeHelperOutDto();
// create the UOW
uow = new UOW();
if (input != null && input.getCodeHelperInElementDtoCount() > 0) {
CodeHelperInElementDto[] inputElements = input.getCodeHelperInElementDtos();
for (int i = 0; i < inputElements.length; i++) output.addCodeHelperOutElementDto(processInputElement(uow, inputElements[i]));
}
// Print Debug Information for the output
if (log.isDebugEnabled()) {
log.debug("Output: " + (output != null ? output.toString() : null));
}
return output;
} finally {
if (uow != null)
uow.rollback();
}
}
Aggregations