use of org.jaffa.modules.printing.services.exceptions.DataNotFoundException in project jaffa-framework by jaffa-projects.
the class InvoiceDataBean method populate.
public void populate() throws FrameworkException, ApplicationExceptions {
if (PENDING_ORDER_NO.equals(orderNo))
throw new ApplicationExceptions(new DataNotReadyException(new String[] { "OrderNo", PENDING_ORDER_NO }));
int lines = 1;
if (VALID_ORDER_NO.equals(orderNo))
lines = 20;
else if (VALID_ORDER_NO2.equals(orderNo) || VALID_LABEL.equals(orderNo))
lines = 2;
else
throw new ApplicationExceptions(new DataNotFoundException(new String[] { "OrderNo", VALID_ORDER_NO }));
this.orderTotal = 0;
// this.orderNo="PO0019657-A";
// this.shippingAddress="A building 2building 3building 4building\nSome Road 2SomeRoad 3SomeRoad 4SomeRoad\nSome City 1SomeCity 2SomeCity 3SomeCity\nUtah 1Utah 2Utah 3Utah 4Utah 5Utah 6Utah 7Utah\nUT 98765 123412353tew5tgwe523451235125125";
this.shippingAddress = "A building\nSome Road\nSome City\nUtah\nUT 98765";
this.vendorAddress = "Acme Road\nAcmeville\nUtah\nUT 98765";
this.vendorCode = "AM001-2";
this.vendorName = "ACME Inc.";
this.orderDate = DateOnly.addDay(new DateOnly(), -7);
this.needDate = DateOnly.addDay(new DateOnly(), 2);
this.remarks = "See additional pages";
this.item = new ArrayList();
for (int i = 0; i < lines && i < partList.length; i++) {
InvoiceLineItem it = new InvoiceLineItem();
this.item.add(it);
it.setItemNo(i + 1);
long qty = quantityList[i];
double price = priceList[i];
it.setQuantity(new Long(qty));
it.setDescription(partList[i]);
it.setUnitPrice(new Double(price));
it.setExtendedPrice(new Double(price * qty));
this.orderTotal += price * qty;
System.out.println(it.toString());
}
}
use of org.jaffa.modules.printing.services.exceptions.DataNotFoundException in project jaffa-framework by jaffa-projects.
the class DomainDataBean method populate.
public void populate() throws FrameworkException, ApplicationExceptions {
// Lookup the "findByPK" method for this domain object
log.debug("Get the findByPK method for " + m_beanClass.getName());
try {
for (Method method : m_beanClass.getDeclaredMethods()) {
if (method.getName().equals("findByPK") && method.getParameterTypes()[0].equals(UOW.class) && method.getParameterTypes().length == m_keys.size() + 1) {
// We have found a sutable method
log.debug("Found Method : " + method.toString());
Object[] args = new Object[method.getParameterTypes().length];
args[0] = (UOW) null;
int argCount = 1;
for (Object arg : m_keys) {
log.debug(" Argument " + argCount + " = " + arg);
args[argCount++] = arg;
}
try {
m_domainObject = method.invoke(null, args);
log.debug("Found Domain Object : " + m_domainObject);
} catch (IllegalAccessException e) {
log.error("Can't invoke " + method.toString(), e);
throw new EngineProcessingException(e.getMessage(), e);
} catch (InvocationTargetException e) {
log.error("Can't invoke " + method.toString(), e);
throw new EngineProcessingException(e.getMessage(), e);
}
if (m_domainObject == null) {
throw new DataNotFoundException(new String[] { "No Method", m_beanClass.getName() });
}
return;
}
}
// Error - method not found
throw new DataNotFoundException("No findByPK method");
} catch (ApplicationException e) {
throw new ApplicationExceptions(e);
}
}
Aggregations