use of com.qcadoo.mes.states.messages.constants.StateMessageType in project mes by qcadoo.
the class StateChangeViewClientUtil method addStateMessageToComponent.
public void addStateMessageToComponent(final ComponentState component, final Entity stateMessage) {
final StateMessageType stateMsgType = parseString(stateMessage.getStringField(MessageFields.TYPE));
if (VALIDATION_ERROR.equals(stateMsgType)) {
return;
}
component.addMessage(getKey(stateMessage), convertViewMessageType(stateMsgType), isAutoClosed(stateMessage), getArgs(stateMessage));
}
use of com.qcadoo.mes.states.messages.constants.StateMessageType in project mes by qcadoo.
the class MessageServiceImpl method addMessage.
@Override
public final void addMessage(final StateChangeContext stateChangeContext, final Entity message) {
final List<Entity> messages = Lists.newArrayList(stateChangeContext.getAllMessages());
messages.add(message);
final String messagesFieldName = stateChangeContext.getDescriber().getMessagesFieldName();
stateChangeContext.setField(messagesFieldName, messages);
final StateMessageType type = StateMessageType.parseString(message.getStringField(MessageFields.TYPE));
if (VALIDATION_ERROR.equals(type) || FAILURE.equals(type)) {
stateChangeContext.setStatus(StateChangeStatus.FAILURE);
}
stateChangeContext.save();
}
use of com.qcadoo.mes.states.messages.constants.StateMessageType in project mes by qcadoo.
the class MessagesUtil method messageIsTypeOf.
public static boolean messageIsTypeOf(final Entity message, final StateMessageType typeLookingFor) {
final String messageStringType = message.getStringField(MessageFields.TYPE);
final StateMessageType messageType = StateMessageType.parseString(messageStringType);
return messageType.equals(typeLookingFor);
}
Aggregations