public void setValue(Object obj) { if (obj == null || obj.equals("")) { throw new TargettedMessageException(new TargettedMessage(code)); } }
public TargettedMessage(String messagecode, Object[] args, Exception exception) { updateMessageCode(messagecode); this.args = args; this.exception = exception; }
public TargettedMessage(String messagecode, Object[] args, String targetid) { updateMessageCode(messagecode); updateTarget(targetid); this.args = args; }
/** Determines whether this message list contains a general action error entry, and * returns it. * @return error or null if no error */ public TargettedMessage findGeneralError() { for (int i = 0; i < size(); ++ i) { TargettedMessage message = messageAt(i); if (CoreMessages.GENERAL_ACTION_ERROR.equals(message.acquireMessageCode())) return message; if (CoreMessages.GENERAL_SHOW_ERROR.equals(message.acquireMessageCode())) return message; } return null; }
public TargettedMessage(String[] messagecodes, Object[] args, String targetid) { updateTarget(targetid); this.messagecodes = messagecodes; this.args = args; }
/** * Does the current state of the TML represent an error? This is determined by * checking for any individual message which is at the * {@link TargettedMessage#SEVERITY_ERROR} severity level. * @return true if there is an error otherwise false */ public boolean isError() { for (int i = 0; i < size(); ++i) { if (messageAt(i).isError()) return true; } return false; }
public void renderMessages(MessageFlyweight flyweight, UIBranchContainer member, List messagelist) { if (messagelist == null || messagelist.size() == 0) return; flyweight.rsfMessages.addComponent(member); for (int i = 0; i < messagelist.size(); ++i) { TargettedMessage message = (TargettedMessage) messagelist.get(i); String resolved = message.resolve(messagelocator); if (resolved == null) { resolved = MessageUtil.renderDefaultMessage(message.messagecodes[0]); } UIOutput.make(member, "message:", resolved); } } }
private Map condenseList(TargettedMessageList messagelist) { Map togo = new HashMap(); boolean doneGeneral = false; for (int i = 0; i < messagelist.size(); ++i) { TargettedMessage message = messagelist.messageAt(i); boolean isGeneral = CoreMessages.GENERAL_ACTION_ERROR.equals(message.acquireMessageCode()); if (isGeneral) { if (doneGeneral) { message = null; } else { doneGeneral = true; } } if (message != null) { MapUtil.putMultiMap(togo, new Integer(message.severity), message); } } return togo; }
/** The fullest constructor for TargettedMessage. * @param messagecodes Message codes to be used for resolution, in descending * order of priority. See {@link MessageLocator} * @param args Any arguments required for substitution in the resolved message. * @param targetid The ID or path that the message is to be targetted at. * @param severity The severity of the message, either {@link #SEVERITY_INFO} or * {@link #SEVERITY_ERROR} */ public TargettedMessage(String[] messagecodes, Object[] args, String targetid, int severity) { updateTarget(targetid); this.messagecodes = messagecodes; this.args = args; this.severity = severity; }
private void parseImpl(Operation op) { try { Date ydate = op.format.parse(op.text); DateUtil.applyFields(date, ydate, op.fields); } catch (Exception e) { isvalid = false; String key = op.fields == DateUtil.DATE_FIELDS? invalidDateKey : (invalidTimeKey == null? invalidDateKey : invalidTimeKey); throw new TargettedMessageException( new TargettedMessage(key, new Object[] {op.text, op.format.toPattern()})); } }
/** Construct a simple targetted message * @param messagecode The message key for resolving the message text. * @param targetid The target field or path of the message, if <code>null</code> * will be substituted with {@link #TARGET_NONE}. */ public TargettedMessage(String messagecode, String targetid) { updateMessageCode(messagecode); this.targetid = targetid == null ? TARGET_NONE : targetid; }
public TargettedMessage(String messagecode, Exception exception, String targetid) { updateMessageCode(messagecode); updateTarget(targetid); this.exception = exception; }
/** * Pack this list into a String for debugging purposes. * @return a String containing the packed list */ public String pack() { CharWrap togo = new CharWrap(); for (int i = 0; i < size(); ++i) { TargettedMessage mess = messageAt(i); togo.append("Target: " + mess.targetid + " message " + mess.acquireMessageCode() + "\n"); } return togo.toString(); }
messages.add(new TargettedMessage(e.getMessage(), e, fieldname)); Logger.log.warn("Error parsing field " + fieldname + " for "
public TargettedMessage(String messagecode, Object[] args, int severity) { updateMessageCode(messagecode); this.args = args; this.severity = severity; }
public TargettedMessage(String messagecode, Object[] args, Exception exception, String targetid) { updateMessageCode(messagecode); updateTarget(targetid); this.args = args; this.exception = exception; }
message.acquireMessageCode() + " targetted at " + message.targetid);
public static TargettedMessage SpringErrortoTargettedMessage(Object erroro) { if (erroro instanceof FieldError) { FieldError error = (FieldError) erroro; TargettedMessage togo = new TargettedMessage(error.getCodes(), error .getArguments(), error.getField()); return togo; } else if (erroro instanceof ObjectError) { ObjectError error = (ObjectError) erroro; TargettedMessage togo = new TargettedMessage(error.getCodes(), error .getArguments(), TargettedMessage.TARGET_NONE); return togo; } else throw new IllegalArgumentException( "Cannot convert Spring Error of unknown " + erroro.getClass()); }
public TargettedMessage(String messagecode, Exception exception) { updateMessageCode(messagecode); this.exception = exception; }
newerror = new TargettedMessage( CoreMessages.GENERAL_SHOW_ERROR, args);