use of org.jaffa.exceptions.FrameworkException in project jaffa-framework by jaffa-projects.
the class QueueViewerTx method addRelatedDtos.
private void addRelatedDtos(QueueViewerInDto input, QueueViewerOutDto output) throws FrameworkException, ApplicationExceptions {
Message[] messages = null;
if (input.getMessageMode() == null || input.getMessageMode() == MessageModeEnum.PENDING)
messages = JmsBrowser.getPendingMessages(input.getQueueName(), input.getFilter());
else
log.warn("Messages cannot be retrieved since unsupported messageMode '" + input.getMessageMode() + "' has been passed");
try {
// Determine the header elements for the queue
QueueInfo queueInfo = ConfigurationService.getInstance().getQueueInfo(input.getQueueName());
if (queueInfo != null && queueInfo.getDisplayParam() != null) {
List<HeaderElementDto> headerElementDtos = new LinkedList<HeaderElementDto>();
for (DisplayParam displayParam : queueInfo.getDisplayParam()) {
HeaderElementDto headerElementDto = new HeaderElementDto();
headerElementDto.setName(displayParam.getName());
headerElementDto.setLabel(displayParam.getLabel());
headerElementDtos.add(headerElementDto);
}
output.setHeaderElements(headerElementDtos.toArray(new HeaderElementDto[headerElementDtos.size()]));
}
if (messages != null && messages.length > 0) {
List<MessageDto> messageDtos = new LinkedList<MessageDto>();
String[] manageableMessages = null;
for (Message message : messages) {
MessageDto messageDto = new MessageDto();
messageDto.setMessageId(message.getJMSMessageID());
if (input.getMessageMode() == MessageModeEnum.IN_PROCESS) {
messageDto.setManageable(Arrays.binarySearch(manageableMessages, message.getJMSMessageID()) >= 0 ? Boolean.TRUE : Boolean.FALSE);
} else
messageDto.setManageable(Boolean.FALSE);
// Evaluate the header elements for the message
if (queueInfo != null && queueInfo.getDisplayParam() != null) {
List<HeaderElementDto> headerElementDtos = new LinkedList<HeaderElementDto>();
for (DisplayParam displayParam : queueInfo.getDisplayParam()) {
HeaderElementDto headerElementDto = new HeaderElementDto();
headerElementDto.setName(displayParam.getName());
headerElementDto.setLabel(displayParam.getLabel());
Object value = message.getObjectProperty(displayParam.getName());
if (value == null) {
// Use bean intropsection to extract the value of the property
try {
if (displayParam.getName().equals("JMSTimestamp")) {
value = message.getJMSTimestamp() != 0 ? new DateTime(message.getJMSTimestamp()) : null;
} else {
value = BeanHelper.getField(message, displayParam.getName());
}
} catch (Exception e) {
// do nothing
}
}
if (value != null)
headerElementDto.setValue(Formatter.format(value));
headerElementDtos.add(headerElementDto);
}
messageDto.setHeaderElements(headerElementDtos.toArray(new HeaderElementDto[headerElementDtos.size()]));
}
messageDtos.add(messageDto);
}
output.setMessages(messageDtos.toArray(new MessageDto[messageDtos.size()]));
}
} catch (JMSException e) {
throw new JaffaMessagingFrameworkException(JaffaMessagingFrameworkException.MESSAGE_INFO_MISSING, null, e);
}
}
use of org.jaffa.exceptions.FrameworkException in project jaffa-framework by jaffa-projects.
the class QueueViewerAction method do_Refresh_Clicked.
public FormKey do_Refresh_Clicked() {
FormKey fk = null;
QueueViewerForm myForm = (QueueViewerForm) form;
QueueViewerComponent myComp = (QueueViewerComponent) myForm.getComponent();
try {
if (myForm.doValidate(request))
myComp.doInquiry();
} catch (ApplicationExceptions e) {
if (log.isDebugEnabled())
log.debug("Refresh Failed");
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
} catch (FrameworkException e) {
log.error(null, e);
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
}
// Direct User back to current form
if (fk == null)
fk = myComp.getViewerFormKey();
return fk;
}
use of org.jaffa.exceptions.FrameworkException in project jaffa-framework by jaffa-projects.
the class QueueViewerAction method do_RelatedQueueHeader_Delete_Clicked.
public FormKey do_RelatedQueueHeader_Delete_Clicked(String rowNum) {
FormKey fk = null;
QueueViewerForm myForm = (QueueViewerForm) form;
QueueViewerComponent myComp = (QueueViewerComponent) myForm.getComponent();
try {
// This will stop double submits
performTokenValidation(request);
GridModel model = (GridModel) myForm.getRelatedQueueHeaderWM();
GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
if (selectedRow != null)
fk = myComp.deleteMessage((java.lang.String) selectedRow.get("messageId"));
// Invoke QueueView Listener
myComp.invokeQueueViewerListeners();
} catch (ApplicationExceptions e) {
if (log.isDebugEnabled())
log.debug("RelatedQueueHeader_Delete Failed");
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
} catch (FrameworkException e) {
log.error(null, e);
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
}
// Direct User back to current form
if (fk == null)
fk = myComp.getViewerFormKey();
return fk;
}
use of org.jaffa.exceptions.FrameworkException in project jaffa-framework by jaffa-projects.
the class QueueViewerAction method do_RelatedQueueHeader_View_Clicked.
public FormKey do_RelatedQueueHeader_View_Clicked(String rowNum) {
FormKey fk = null;
QueueViewerForm myForm = (QueueViewerForm) form;
QueueViewerComponent myComp = (QueueViewerComponent) myForm.getComponent();
try {
GridModel model = (GridModel) myForm.getRelatedQueueHeaderWM();
GridModelRow selectedRow = model.getRow(Integer.parseInt(rowNum));
if (selectedRow != null)
fk = myComp.viewMessage((java.lang.String) selectedRow.get("messageId"));
} catch (ApplicationExceptions e) {
if (log.isDebugEnabled())
log.debug("RelatedQueueHeader_View Failed");
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, e);
} catch (FrameworkException e) {
log.error(null, e);
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
}
// The Viewer will be rendered in a new window
// We don't want to see the existing HistoryNav in that window
// Hence, initialize the HistoryNav
HistoryNav.initializeHistoryNav(request);
// Direct User back to current form
if (fk == null)
fk = myComp.getViewerFormKey();
return fk;
}
use of org.jaffa.exceptions.FrameworkException in project jaffa-framework by jaffa-projects.
the class DefaultValueEditorAction method do_Save_Clicked.
/**
* Clicked event handler for the field Save.
* @return The FormKey.
*/
public FormKey do_Save_Clicked() {
FormKey fk = null;
DefaultValueEditorForm myForm = (DefaultValueEditorForm) form;
DefaultValueEditorComponent myComp = (DefaultValueEditorComponent) myForm.getComponent();
try {
if (invokeDoValidateForScreen(myComp.getCurrentScreenCounter())) {
myComp.saveDefaultValues();
}
} catch (FrameworkException e) {
log.error(null, e);
myForm.raiseError(request, ActionMessages.GLOBAL_MESSAGE, "error.framework.general");
}
fk = myComp.determineFormKey();
return fk;
}
Aggregations