use of org.jaffa.modules.printing.components.formselectionmaintenance.IAdditionalDataObject in project jaffa-framework by jaffa-projects.
the class CustomDataBeanFactory method getInstance.
public IDataBean getInstance() throws FrameworkException, ApplicationExceptions {
// Construct the DataBean
IDataBean dataBean = null;
IAdditionalDataObject dataBean2 = null;
try {
log.debug("Created a Custom DataBean " + m_beanClass);
dataBean = (IDataBean) m_beanClass.newInstance();
if (m_beanClass.newInstance() instanceof IAdditionalDataObject) {
if (dataBean != null) {
dataBean2 = (IAdditionalDataObject) dataBean;
dataBean2.setAdditionalDataObject(additionalDataObject);
}
}
} catch (IllegalAccessException e) {
log.error("Can't create data bean", e);
throw new EngineProcessingException(e.getMessage(), e);
} catch (InstantiationException e) {
log.error("Can't create data bean", e);
throw new EngineProcessingException(e.getMessage(), e);
}
if (dataBean == null)
throw new EngineProcessingException("No CustomDataBean created");
// Populate the keys
if (m_keys != null) {
for (String field : m_keys.keySet()) {
String value = m_keys.get(field);
try {
BeanHelper.setField(dataBean, field, value);
} catch (IntrospectionException e) {
log.error("Can't set bean property " + field, e);
} catch (IllegalAccessException e) {
log.error("Can't set bean property " + field, e);
} catch (InvocationTargetException e) {
log.error("Can't set bean property " + field, e);
}
}
}
if (m_formName != null) {
try {
BeanHelper.setField(dataBean, "formName", m_formName);
} catch (IntrospectionException e) {
log.error("Can't set bean property formName. " + e);
} catch (IllegalAccessException e) {
log.error("Can't set bean property formName. " + e);
} catch (InvocationTargetException e) {
log.error("Can't set bean property formName. " + e);
}
}
// Now make sure the bean has data in it
dataBean.populate();
return dataBean;
}
use of org.jaffa.modules.printing.components.formselectionmaintenance.IAdditionalDataObject in project jaffa-framework by jaffa-projects.
the class FormSelectionMaintenanceComponent method doUpdateDetail.
/**
* Show the AdditionalData Component.
* Pass the Additional Data Object if there is one.
*/
public FormKey doUpdateDetail(GridModelRow selectedRow, String actionPath) throws ApplicationExceptions, FrameworkException {
FormKey fk = null;
String additionalComponent = null;
try {
final FormSelectionMaintenanceOutRowDto rowDto = (FormSelectionMaintenanceOutRowDto) selectedRow.get("object");
additionalComponent = rowDto.getAdditionalDataComponent();
Component comp = (Component) run(additionalComponent);
BeanUtils.setProperty(comp, getKey1(), getValue1());
if (getKey2() != null) {
BeanUtils.setProperty(comp, getKey2(), getValue2());
}
if (getKey3() != null) {
BeanUtils.setProperty(comp, getKey3(), getValue3());
}
if (getKey4() != null) {
BeanUtils.setProperty(comp, getKey4(), getValue4());
}
if (getKey5() != null) {
BeanUtils.setProperty(comp, getKey5(), getValue5());
}
if (getKey6() != null) {
BeanUtils.setProperty(comp, getKey6(), getValue6());
}
// implements IAdditionalDataObject.
if (comp instanceof IAdditionalDataObject) {
((IAdditionalDataObject) comp).setAdditionalDataObject(rowDto.getAdditionalDataObject());
((IUpdateComponent) comp).addUpdateListener(new IUpdateListener() {
public void updateDone(EventObject source) {
try {
rowDto.setAdditionalDataObject(((IAdditionalDataObject) source.getSource()).getAdditionalDataObject());
} catch (Exception e) {
log.warn("Error setting the Additional Data Object after the Update", e);
}
}
});
}
comp.setReturnToFormKey(getResultsFormKey());
// Populate info to allow Web 2.0 component to return to this component
if (comp instanceof RiaWrapperComponent) {
RiaWrapperComponent c = (RiaWrapperComponent) comp;
c.getParameters().setProperty("returnToActionPath", actionPath);
c.getParameters().setProperty("returnToFormKey_componentId", comp.getReturnToFormKey().getComponentId());
}
fk = comp.display();
} catch (SecurityException se) {
log.error("SecurityException Occurred ", se);
throw new ApplicationExceptions(new FormSelectionException(FormSelectionException.SECURITY_EXCEPTION));
} catch (IllegalAccessException e) {
log.error("IllegalAccessException Occurred ", e);
} catch (InvocationTargetException e) {
log.error("InvocationTargetException Occurred ", e);
} catch (IllegalArgumentException e) {
log.error("IllegalArgumentException Occurred ", e);
} catch (ApplicationExceptions applicationException) {
throw applicationException;
} catch (FrameworkException frameworkException) {
throw frameworkException;
}
return fk;
}
Aggregations