FlowDefinitionResource now has a public static helper method named conventionalFlowId that implements conventions based flow id calculation logic.
This commit is contained in:
@@ -35,6 +35,8 @@ Package org.springframework.webflow.conversation
|
||||
|
||||
Package org.springframework.webflow.definition
|
||||
* Added debug logging to FlowDefinitionRegistryImpl.
|
||||
* FlowDefinitionResource now has a public static helper method named conventionalFlowId that implements
|
||||
conventions based flow id calculation logic.
|
||||
|
||||
Package org.springframework.webflow.engine
|
||||
* The methods getMatchingCriteria, getExecutionCriteria, getTargetStateResolver, and canExecute
|
||||
|
||||
@@ -52,12 +52,21 @@ public class FlowDefinitionResource implements Serializable {
|
||||
/**
|
||||
* Creates a new externalized flow definition resource. The flow id assigned will be
|
||||
* the same name as the externalized resource's filename, excluding the extension.
|
||||
* @param location the flow resource location.
|
||||
* @param location the flow resource location
|
||||
*/
|
||||
public FlowDefinitionResource(Resource location) {
|
||||
Assert.notNull(location, "The location of the externalized flow definition is required");
|
||||
init(conventionalFlowId(location), location, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new externalized flow definition resource. The flow id assigned will be
|
||||
* the same name as the externalized resource's filename, excluding the extension.
|
||||
* @param location the flow resource location
|
||||
* @param attributes flow definition attributes to be assigned
|
||||
*/
|
||||
public FlowDefinitionResource(Resource location, AttributeMap attributes) {
|
||||
init(conventionalFlowId(location), location, attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new externalized flow definition.
|
||||
@@ -128,12 +137,16 @@ public class FlowDefinitionResource implements Serializable {
|
||||
this.attributes = CollectionUtils.EMPTY_ATTRIBUTE_MAP;
|
||||
}
|
||||
}
|
||||
|
||||
// public utilities
|
||||
|
||||
/**
|
||||
* Returns the flow id assigned to the flow definition contained in given resource.
|
||||
* By convention this will be the filename of the resource, excluding extension.
|
||||
* @see FlowDefinitionResource#FlowDefinitionResource(Resource)
|
||||
* @see FlowDefinitionResource#FlowDefinitionResource(Resource, AttributeMap)
|
||||
*/
|
||||
private String conventionalFlowId(Resource location) {
|
||||
public static String conventionalFlowId(Resource location) {
|
||||
String fileName = location.getFilename();
|
||||
int extensionIndex = fileName.lastIndexOf('.');
|
||||
if (extensionIndex != -1) {
|
||||
|
||||
Reference in New Issue
Block a user