2009/05/20 - Apache Shale has been retired.

For more information, please explore the Attic.

View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to you under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.shale.dialog.scxml;
19  
20  import javax.faces.context.FacesContext;
21  
22  /***
23   * <p>{@link DialogStateMapper} is an interface describing a pluggable
24   * mechanism to map between the state ID within a SCXML dialog definition
25   * and the corresponding JavaServer Faces <em>view identifier</em>
26   * that should be rendered when the dialog state machine comes to rest in
27   * that state.</p>
28   *
29   * <p>By default, an identity transform is applied i.e. the
30   * JavaServer Faces <code>view identifier</code> used is the same as
31   * the dialog state identifier.</p>
32   *
33   * <p>The default behavior can be changed by replacing the application
34   * scoped bean at key {@link Globals#STATE_MAPPER}. The replacement
35   * must implement {@link DialogStateMapper}.</p>
36   *
37   * @since 1.0.4
38   *
39   * $Id: DialogStateMapper.java 469656 2006-10-31 21:18:18Z rahul $
40   */
41  public interface DialogStateMapper {
42  
43      /***
44       * <p>Return the JavaServer Faces <code>view identifier</code> that
45       * corresponds to current dialog state. The current {@link FacesContext}
46       * instance is also available so developers can consult pertinent
47       * information such as user role, current locale, user agent making
48       * the request etc. to map the state identifier to the view
49       * identifier, if needed.</p>
50       *
51       * @param dialogName The logical name of the dialog this state belongs to
52       * @param stateId The state identifier for the current dialog state
53       * @param context The current {@link FacesContext}
54       * @return The JavaServer Faces <code>view identifier</code> that should
55       *         be rendered
56       */
57      public String mapStateId(String dialogName, String stateId,
58                              FacesContext context);
59  
60  }
61