本文整理了Java中org.springframework.webflow.execution.Event.getId()
方法的一些代码示例,展示了Event.getId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.getId()
方法的具体详情如下:
包路径:org.springframework.webflow.execution.Event
类名称:Event
方法名:getId
[英]Returns the event identifier.
[中]返回事件标识符。
代码示例来源:origin: org.springframework.webflow/spring-webflow
public String toString() {
return getId();
}
}
代码示例来源:origin: org.springframework.webflow/spring-webflow
public boolean test(RequestContext context) {
Object result = expression.getValue(context);
if (result == null) {
return false;
} else if (result instanceof Boolean) {
return (Boolean) result;
} else {
String eventId = String.valueOf(result);
return context.getCurrentEvent().getId().equals(eventId);
}
}
代码示例来源:origin: org.springframework.webflow/spring-webflow
public final Event execute(RequestContext context) throws Exception {
Event result = doPreExecute(context);
if (result == null) {
result = doExecute(context);
doPostExecute(context);
} else {
if (logger.isInfoEnabled()) {
logger.info("Action execution disallowed; pre-execution result is '" + result.getId() + "'");
}
}
return result;
}
代码示例来源:origin: org.springframework.webflow/spring-webflow
private boolean handleEvent(View view, RequestControlContext context) {
view.processUserEvent();
if (view.hasFlowEvent()) {
Event event = view.getFlowEvent();
if (logger.isDebugEnabled()) {
logger.debug("Event '" + event.getId() + "' returned from view " + view);
}
return context.handleEvent(event);
} else {
return false;
}
}
代码示例来源:origin: org.springframework.webflow/spring-webflow
/**
* Get the event id to be used as grounds for a transition in the containing state, based on given result returned
* from action execution.
* <p>
* If the wrapped action is named, the name will be used as a qualifier for the event (e.g. "myAction.success").
* @param resultEvent the action result event
*/
protected Event postProcessResult(Event resultEvent) {
if (resultEvent == null) {
return null;
}
if (isNamed()) {
// qualify result event id with action name for a named action
String qualifiedId = getName() + "." + resultEvent.getId();
if (logger.isDebugEnabled()) {
logger.debug("Qualifying action result '" + resultEvent.getId() + "'; qualified result = '"
+ qualifiedId + "'");
}
resultEvent = new Event(resultEvent.getSource(), qualifiedId, resultEvent.getAttributes());
}
return resultEvent;
}
代码示例来源:origin: org.springframework.webflow/spring-webflow
public boolean test(RequestContext context) {
Event result = ActionExecutor.execute(getAction(), context);
return result != null && isTrueEvent(result.getId());
}
代码示例来源:origin: org.springframework.webflow/spring-webflow
public Event doExecute(RequestContext context) throws Exception {
Action[] actions = getActions();
String eventId = getEventFactorySupport().getSuccessEventId();
MutableAttributeMap<Object> eventAttributes = new LocalAttributeMap<>();
List<Event> actionResults = new ArrayList<>(actions.length);
for (Action action : actions) {
Event result = action.execute(context);
actionResults.add(result);
if (result != null) {
eventId = result.getId();
if (isStopOnError() && result.getId().equals(getEventFactorySupport().getErrorEventId())) {
break;
}
}
}
eventAttributes.put(ACTION_RESULTS_ATTRIBUTE_NAME, actionResults);
return new Event(this, eventId, eventAttributes);
}
代码示例来源:origin: org.springframework.webflow/spring-webflow
Event event = ActionExecutor.execute(action, context);
if (event != null) {
eventIds[executionCount] = event.getId();
try {
context.handleEvent(event);
+ (executionCount + 1)
+ "] resulted in no matching transition on event '"
+ event.getId()
+ "'"
+ (it.hasNext() ? ": proceeding to the next action in the list"
代码示例来源:origin: spring-projects/spring-webflow
public boolean test(RequestContext context) {
Object result = expression.getValue(context);
if (result == null) {
return false;
} else if (result instanceof Boolean) {
return (Boolean) result;
} else {
String eventId = String.valueOf(result);
return context.getCurrentEvent().getId().equals(eventId);
}
}
代码示例来源:origin: org.springframework/spring-webflow
public boolean test(RequestContext context) {
Event result = ActionExecutor.execute(getAction(), context);
return result != null && getTrueEventId().equals(result.getId());
}
}
代码示例来源:origin: spring-projects/spring-webflow
public void testDoExecuteWithNullResult() throws Exception {
tested.setStopOnError(true);
MockRequestContext mockRequestContext = new MockRequestContext();
EasyMock.expect(actionMock.execute(mockRequestContext)).andReturn(null);
EasyMock.replay(actionMock);
Event result = tested.doExecute(mockRequestContext);
EasyMock.verify(actionMock);
assertEquals("Expecting success since no check is performed if null result,", "success", result.getId());
}
代码示例来源:origin: spring-projects/spring-webflow
public void testBoolean() {
Event event = factory.createResultEvent(this, true, new MockRequestContext());
assertEquals(factory.getYesEventId(), event.getId());
event = factory.createResultEvent(this, false, new MockRequestContext());
assertEquals(factory.getNoEventId(), event.getId());
}
代码示例来源:origin: spring-projects/spring-webflow
public void testBooleanFalseEvent() {
Event e = support.event(source, false);
assertEquals("no", e.getId());
assertSame(source, e.getSource());
}
代码示例来源:origin: spring-projects/spring-webflow
public void testEvent() {
Event e = support.event(source, "no");
assertEquals("no", e.getId());
assertSame(source, e.getSource());
}
代码示例来源:origin: spring-projects/spring-webflow
public void testEvaluateExpressionNoResultExposer() throws Exception {
EvaluateAction action = new EvaluateAction(new StaticExpression("bar"), null);
MockRequestContext context = new MockRequestContext();
Event result = action.execute(context);
assertEquals("bar", result.getId());
}
代码示例来源:origin: spring-projects/spring-webflow
public void testEvaluateExpressionEmptyStringResult() throws Exception {
EvaluateAction action = new EvaluateAction(new StaticExpression(""), null);
MockRequestContext context = new MockRequestContext();
Event result = action.execute(context);
assertEquals("null", result.getId());
}
代码示例来源:origin: spring-projects/spring-webflow
public void testSuccessResult() {
Object o = new Object();
Event event = action.success(o);
assertEquals(action.getEventFactorySupport().getSuccessEventId(), event.getId());
assertSame(o, event.getAttributes().get(action.getEventFactorySupport().getResultAttributeName()));
}
代码示例来源:origin: spring-projects/spring-webflow
public void testMockActionExecuteCustomResult() {
MockAction action = new MockAction("foo");
Event e = action.execute(new MockRequestContext());
assertEquals("foo", e.getId());
assertTrue(e.getAttributes().isEmpty());
}
代码示例来源:origin: spring-projects/spring-webflow
public void testCustomResultCollection() {
LocalAttributeMap<Object> collection = new LocalAttributeMap<>();
collection.put("result", "value");
Event event = action.result("custom", collection);
assertEquals("custom", event.getId());
assertEquals("value", event.getAttributes().getString("result"));
}
}
代码示例来源:origin: spring-projects/spring-webflow
public void testEventWithAttrs() {
Event e = support.event(source, "no", "foo", "bar");
assertEquals("no", e.getId());
assertEquals("bar", e.getAttributes().get("foo"));
assertSame(source, e.getSource());
}
内容来源于网络,如有侵权,请联系作者删除!