use of org.jaffa.modules.scheduler.services.JaffaSchedulerFrameworkException in project jaffa-framework by jaffa-projects.
the class TaskMaintenanceComponent method initDropDownCodes.
/**
* This will retrieve the set of codes for dropdowns, if any are required
* @throws ApplicationExceptions This will be thrown in case any invalid data has been set.
* @throws FrameworkException Indicates some system error.
*/
protected void initDropDownCodes() throws ApplicationExceptions, FrameworkException {
ApplicationExceptions appExps = null;
CodeHelperInDto input = null;
if (getBusinessObjectXML() != null && getTaskType() != null) {
Task task = SchedulerConfiguration.getInstance().getTask(getTaskType());
if (task != null && task.getDataBean() != null) {
try {
setBusinessObject(JAXBHelper.unmarshalPayload(getBusinessObjectXML(), task.getDataBean()));
} catch (JAXBException e) {
log.error("A task has not been configured for the dataBean " + task.getDataBean(), e);
throw new JaffaSchedulerFrameworkException(JaffaSchedulerFrameworkException.MISSING_TASK_FOR_DATA_BEAN, new Object[] { task.getDataBean() }, e);
} catch (ClassNotFoundException e) {
log.error("A task has not been configured for the dataBean " + task.getDataBean(), e);
throw new JaffaSchedulerFrameworkException(JaffaSchedulerFrameworkException.MISSING_TASK_FOR_DATA_BEAN, new Object[] { task.getDataBean() }, e);
}
}
}
// Initialize the taskType DropDown
m_taskTypeCodes = new TreeSet<String>();
if (getBusinessObject() != null) {
try {
Task task = SchedulerConfiguration.getInstance().getTaskByDataBean(getBusinessObject().getClass().getName());
if (task != null)
m_taskTypeCodes.add(task.getType());
} catch (ClassNotFoundException e) {
log.error("A task has not been configured for the dataBean " + getBusinessObject().getClass().getName(), e);
throw new JaffaSchedulerFrameworkException(JaffaSchedulerFrameworkException.MISSING_TASK_FOR_DATA_BEAN, new Object[] { getBusinessObject().getClass().getName() }, e);
}
} else {
Task[] tasks = SchedulerConfiguration.getInstance().getTasks();
if (tasks != null) {
for (Task task : tasks) {
if (task.isAutoCreateDataBean() && SchedulerBrowser.hasBrowseTaskAccess(task.getType()))
m_taskTypeCodes.add(task.getType());
}
}
}
}
Aggregations