private FlowDefinitionHolder createFlowDefinitionHolder(FlowDefinitionResource flowResource) { FlowBuilder builder = createFlowBuilder(flowResource); FlowBuilderContext builderContext = new FlowBuilderContextImpl(flowResource.getId(), flowResource.getAttributes(), flowRegistry, flowBuilderServices); FlowAssembler assembler = new FlowAssembler(builder, builderContext); return new DefaultFlowHolder(assembler); }
/** * Creates a new flow builder context. * @param flowId the id to assign the flow being built * @param flowAttributes attributes to assign the flow being built * @param flowDefinitionLocator a locator to find dependent subflows * @param flowBuilderServices a parameter object providing access to additional services needed by the flow builder */ public FlowBuilderContextImpl(String flowId, AttributeMap<Object> flowAttributes, FlowDefinitionLocator flowDefinitionLocator, FlowBuilderServices flowBuilderServices) { Assert.hasText(flowId, "The flow id is required"); Assert.notNull(flowDefinitionLocator, "The flow definition locator is required"); Assert.notNull(flowBuilderServices, "The flow builder services holder is required"); this.flowId = flowId; initFlowAttributes(flowAttributes); this.flowDefinitionLocator = flowDefinitionLocator; this.flowBuilderServices = flowBuilderServices; this.conversionService = createConversionService(); }
public ConversionExecutor getConversionExecutor(Class<?> sourceClass, Class<?> targetClass) throws ConversionExecutionException { return getFlowBuilderServices().getConversionService().getConversionExecutor(sourceClass, targetClass); }
private void registerFlowBuilders(DefaultFlowRegistry flowRegistry) { for (FlowBuilderInfo info : this.flowBuilderInfos) { AttributeMap<Object> attributes = info.getAttributes(); updateFlowAttributes(attributes); FlowBuilderContext builderContext = new FlowBuilderContextImpl( info.getId(), attributes, flowRegistry, this.flowBuilderServices); FlowAssembler assembler = new FlowAssembler(info.getBuilder(), builderContext); flowRegistry.registerFlowDefinition(assembler.assembleFlow()); } }
public ConversionExecutor getConversionExecutor(String id, Class<?> sourceClass, Class<?> targetClass) throws ConversionExecutorNotFoundException { return getFlowBuilderServices().getConversionService().getConversionExecutor(id, sourceClass, targetClass); }
/** * Creates a new flow builder context. * @param flowId the id to assign the flow being built * @param flowAttributes attributes to assign the flow being built * @param flowDefinitionLocator a locator to find dependent subflows * @param flowBuilderServices a parameter object providing access to additional services needed by the flow builder */ public FlowBuilderContextImpl(String flowId, AttributeMap<Object> flowAttributes, FlowDefinitionLocator flowDefinitionLocator, FlowBuilderServices flowBuilderServices) { Assert.hasText(flowId, "The flow id is required"); Assert.notNull(flowDefinitionLocator, "The flow definition locator is required"); Assert.notNull(flowBuilderServices, "The flow builder services holder is required"); this.flowId = flowId; initFlowAttributes(flowAttributes); this.flowDefinitionLocator = flowDefinitionLocator; this.flowBuilderServices = flowBuilderServices; this.conversionService = createConversionService(); }
private void registerFlow(FlowDefinitionResource resource, DefaultFlowRegistry flowRegistry) { FlowModelBuilder flowModelBuilder; if (resource.getPath().getFilename().endsWith(".xml")) { flowModelBuilder = new XmlFlowModelBuilder(resource.getPath(), flowRegistry.getFlowModelRegistry()); } else { throw new IllegalArgumentException(resource + " is not a supported resource type; supported types are [.xml]"); } FlowModelHolder flowModelHolder = new DefaultFlowModelHolder(flowModelBuilder); FlowBuilder flowBuilder = new FlowModelFlowBuilder(flowModelHolder); FlowBuilderContext builderContext = new FlowBuilderContextImpl( resource.getId(), resource.getAttributes(), flowRegistry, this.flowBuilderServices); FlowAssembler assembler = new FlowAssembler(flowBuilder, builderContext); DefaultFlowHolder flowHolder = new DefaultFlowHolder(assembler); flowRegistry.getFlowModelRegistry().registerFlowModel(resource.getId(), flowModelHolder); flowRegistry.registerFlowDefinition(flowHolder); }
public org.springframework.core.convert.ConversionService getDelegateConversionService() { return getFlowBuilderServices().getConversionService().getDelegateConversionService(); } }
/** * Creates a new flow builder context. * @param flowId the id to assign the flow being built * @param flowAttributes attributes to assign the flow being built * @param flowDefinitionLocator a locator to find dependent subflows * @param flowBuilderServices a parameter object providing access to additional services needed by the flow builder */ public FlowBuilderContextImpl(String flowId, AttributeMap flowAttributes, FlowDefinitionLocator flowDefinitionLocator, FlowBuilderServices flowBuilderServices) { Assert.hasText(flowId, "The flow id is required"); Assert.notNull(flowDefinitionLocator, "The flow definition locator is required"); Assert.notNull(flowBuilderServices, "The flow builder services holder is required"); this.flowId = flowId; initFlowAttributes(flowAttributes); this.flowDefinitionLocator = flowDefinitionLocator; this.flowBuilderServices = flowBuilderServices; this.conversionService = createConversionService(); }
private FlowDefinition buildFlowDefinition(FlowBuilderInfo builderInfo) { try { Class<?> flowBuilderClass = loadClass(builderInfo.getClassName()); FlowBuilder builder = (FlowBuilder) flowBuilderClass.newInstance(); AttributeMap<Object> flowAttributes = getFlowAttributes(builderInfo.getAttributes()); FlowBuilderContext builderContext = new FlowBuilderContextImpl(builderInfo.getId(), flowAttributes, flowRegistry, flowBuilderServices); FlowAssembler assembler = new FlowAssembler(builder, builderContext); return assembler.assembleFlow(); } catch (IllegalArgumentException e) { throw new FlowDefinitionConstructionException(builderInfo.getId(), e); } catch (InstantiationException e) { throw new FlowDefinitionConstructionException(builderInfo.getId(), e); } catch (IllegalAccessException e) { throw new FlowDefinitionConstructionException(builderInfo.getId(), e); } }
public Class<?> getClassForAlias(String name) { return getFlowBuilderServices().getConversionService().getClassForAlias(name); }
private FlowDefinitionHolder createFlowDefinitionHolder(FlowDefinitionResource flowResource) { FlowBuilder builder = createFlowBuilder(flowResource); FlowBuilderContext builderContext = new FlowBuilderContextImpl(flowResource.getId(), flowResource.getAttributes(), flowRegistry, flowBuilderServices); FlowAssembler assembler = new FlowAssembler(builder, builderContext); return new DefaultFlowHolder(assembler); }
public Object executeConversion(Object source, Class<?> targetClass) throws ConversionException { return getFlowBuilderServices().getConversionService().executeConversion(source, targetClass); }
private FlowDefinitionHolder createFlowDefinitionHolder(FlowDefinitionResource flowResource) { FlowBuilder builder = createFlowBuilder(flowResource); FlowBuilderContext builderContext = new FlowBuilderContextImpl(flowResource.getId(), flowResource .getAttributes(), flowRegistry, flowBuilderServices); FlowAssembler assembler = new FlowAssembler(builder, builderContext); return new DefaultFlowHolder(assembler); }
public Object executeConversion(String converterId, Object source, Class<?> targetClass) { return getFlowBuilderServices().getConversionService().executeConversion(converterId, source, targetClass); }
/** * Register a flow resource into the registry. * * @param resource the flow resource * @param flowRegistry the registry */ private void registerFlow(@Nonnull final FlowDefinitionResource resource, @Nonnull final DefaultFlowRegistry flowRegistry) { FlowModelBuilder flowModelBuilder = null; if (resource.getPath().getFilename().endsWith(".xml")) { flowModelBuilder = new XmlFlowModelBuilder(resource.getPath(), flowRegistry.getFlowModelRegistry()); } else { throw new IllegalArgumentException(resource + " is not a supported resource type; supported types are [.xml]"); } final FlowModelHolder flowModelHolder = new DefaultFlowModelHolder(flowModelBuilder); final FlowBuilder flowBuilder = new FlowModelFlowBuilder(flowModelHolder); final FlowBuilderContext builderContext = new FlowBuilderContextImpl( resource.getId(), resource.getAttributes(), flowRegistry, this.flowBuilderServices); final FlowAssembler assembler = new FlowAssembler(flowBuilder, builderContext); final DefaultFlowHolder flowHolder = new DefaultFlowHolder(assembler); flowRegistry.getFlowModelRegistry().registerFlowModel(resource.getId(), flowModelHolder); flowRegistry.registerFlowDefinition(flowHolder); log.debug("Registered flow ID '{}' using '{}'", resource.getId(), resource.getPath()); }
/** * Factory method that creates the conversion service the flow builder will use. Subclasses may override. The * default implementation registers Web Flow-specific converters thought to be useful for most builder * implementations, setting the externally-provided builder services conversion service as its parent. * @return the flow builder conversion service */ protected ConversionService createConversionService() { GenericConversionService service = new GenericConversionService( getFlowBuilderServices().getConversionService().getDelegateConversionService()); service.addConverter(new TextToTransitionCriteria(this)); service.addConverter(new TextToTargetStateResolver(this)); service.setParent(new ParentConversionServiceProxy()); return service; }
private void registerFlowBuilders(DefaultFlowRegistry flowRegistry) { for (FlowBuilderInfo info : this.flowBuilderInfos) { AttributeMap<Object> attributes = info.getAttributes(); updateFlowAttributes(attributes); FlowBuilderContext builderContext = new FlowBuilderContextImpl( info.getId(), attributes, flowRegistry, this.flowBuilderServices); FlowAssembler assembler = new FlowAssembler(info.getBuilder(), builderContext); flowRegistry.registerFlowDefinition(assembler.assembleFlow()); } }
public ConversionExecutor getConversionExecutor(Class<?> sourceClass, Class<?> targetClass) throws ConversionExecutionException { return getFlowBuilderServices().getConversionService().getConversionExecutor(sourceClass, targetClass); }
private void registerFlow(FlowDefinitionResource resource, DefaultFlowRegistry flowRegistry) { FlowModelBuilder flowModelBuilder; if (resource.getPath().getFilename().endsWith(".xml")) { flowModelBuilder = new XmlFlowModelBuilder(resource.getPath(), flowRegistry.getFlowModelRegistry()); } else { throw new IllegalArgumentException(resource + " is not a supported resource type; supported types are [.xml]"); } FlowModelHolder flowModelHolder = new DefaultFlowModelHolder(flowModelBuilder); FlowBuilder flowBuilder = new FlowModelFlowBuilder(flowModelHolder); FlowBuilderContext builderContext = new FlowBuilderContextImpl( resource.getId(), resource.getAttributes(), flowRegistry, this.flowBuilderServices); FlowAssembler assembler = new FlowAssembler(flowBuilder, builderContext); DefaultFlowHolder flowHolder = new DefaultFlowHolder(assembler); flowRegistry.getFlowModelRegistry().registerFlowModel(resource.getId(), flowModelHolder); flowRegistry.registerFlowDefinition(flowHolder); }