diff --git a/spring-webflow/changelog.txt b/spring-webflow/changelog.txt index 31f35643..3b8154c7 100644 --- a/spring-webflow/changelog.txt +++ b/spring-webflow/changelog.txt @@ -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 diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionResource.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionResource.java index 03b324fb..0e400896 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionResource.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionResource.java @@ -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) {