@Override
public List<KeyValue> getKeyValues(ViewModel model) {
List<KeyValue> keyValues = new ArrayList<KeyValue>();
Matter matter = null;
if (model instanceof MatterTxForm) {
MatterTxForm form = (MatterTxForm) model;
if (form.getDocument() != null) {
MatterTxDocBase doc = ((MatterTxDocBase)form.getDocument());
if (doc.isMatterIdValid()) {
matter = getBusinessObjectService().findBySinglePrimaryKey(
Matter.class, doc.getMatterId());
}
}
} else if (model instanceof InquiryForm) {
InquiryForm form = (InquiryForm) model;
if (form.getDataObject() instanceof Matter) {
matter = (Matter) form.getDataObject();
} else if (form.getDataObject() instanceof MatterConsideration) {
matter = ((MatterConsideration) form.getDataObject()).getMatter();
}
}
if (matter != null && matter.getClients() != null && !matter.getClients().isEmpty()) {
for (Object clientObj: matter.getClients()) {
MatterClient client = (MatterClient)clientObj;