use of org.jaffa.components.codehelper.dto.CodeHelperInElementDto 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.CodeHelperInElementDto in project jaffa-framework by jaffa-projects.
the class CodeHelperTx method main.
/**
* Test stub
* @param args arguments
*/
public static void main(String[] args) {
try {
org.apache.log4j.BasicConfigurator.configure();
CodeHelperTx tx = new CodeHelperTx();
int testCode = 1;
switch(testCode) {
case 1:
{
// test getCode
CodeHelperInDto in = new CodeHelperInDto();
CodeHelperInElementDto element1 = new CodeHelperInElementDto();
element1.setDomainClassName("org.example.applications.app1.modules.request.domain.ReqRemarks");
element1.setCodeFieldName("RequestId");
element1.setDescriptionFieldName("remarks");
// element1.addCriteriaField(new StringCriteriaField("RequestId", "In", new String[] {"REQ02658", "REQ02659", "REQ00645"}));
in.addCodeHelperInElementDto(element1);
tx.getCodes(in);
}
break;
}
} catch (ApplicationExceptions e) {
for (Iterator itr = e.iterator(); itr.hasNext(); ) ((Exception) itr.next()).printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.jaffa.components.codehelper.dto.CodeHelperInElementDto 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