springbeannameworkflowfactory.java
来自「Java编译osworkflow工作流系统的安装和源代码」· Java 代码 · 共 108 行
JAVA
108 行
/* * Copyright (c) 2002-2003 by OpenSymphony * All rights reserved. */package com.opensymphony.workflow.loader;import com.opensymphony.workflow.FactoryException;import org.springframework.context.ApplicationContext;import org.springframework.context.ApplicationContextAware;import java.util.Properties;/** * Spring-compliant implementation of {@link AbstractWorkflowFactory}. This * workflow factory retrieves {@link WorkflowDescriptor}s from the Spring's * {@link ApplicationContext}. The name of the WorkflowDescriptors is the name * of the bean in the applicationContext. <br /> * Motivation: reduce number of external configuration files leaving only * workflow definitions files. <br /> * <ul> * <li>SpringConfiguration replaces osworkflow.xml</li> * <li>WorkflowFactoryImpl replaces workflows.xml</li> * </ul> * Usage: * <pre> * <bean id="myworkflow" class="com.opensymphony.workflow.loader.WorkflowDescriptorFactoryBean"> * <property name="descriptorResource"> * <value>classpath:/META-INF/workflow/myworkflow.xml</value> * </property> * </bean> * * <bean id="workflowFactory" class="com.opensymphony.workflow.loader.BeanNameWorkflowFactory"/> * </pre> * * @author xd */public class SpringBeanNameWorkflowFactory implements WorkflowFactory, ApplicationContextAware { //~ Instance fields //////////////////////////////////////////////////////// //////////////////////////////////////////////////~ Instance attributes. // /** The applicationContext. */ private ApplicationContext applicationContext; //~ Methods //////////////////////////////////////////////////////////////// public void setApplicationContext(final ApplicationContext inApplicationContext) { this.applicationContext = inApplicationContext; } public void setLayout(String workflowName, Object layout) { } public Object getLayout(String workflowName) { return null; } public boolean isModifiable(String name) { return false; } public String getName() { return null; } public Properties getProperties() { return null; } //////////////////////////~ AbstractWorkflowFactory implemented methods. // public WorkflowDescriptor getWorkflow(final String inName) { return (WorkflowDescriptor) this.applicationContext.getBean(inName); } public WorkflowDescriptor getWorkflow(String name, boolean validate) throws FactoryException { return getWorkflow(name); } public String[] getWorkflowNames() { return this.applicationContext.getBeanDefinitionNames(WorkflowDescriptor.class); } public void createWorkflow(String name) { } public void init(Properties p) { } public void initDone() throws FactoryException { } public boolean removeWorkflow(final String inName) throws FactoryException { throw new FactoryException("Unsupported operation."); } public void renameWorkflow(String oldName, String newName) { } public void save() { } public boolean saveWorkflow(final String inName, final WorkflowDescriptor inDescriptor, final boolean inReplace) throws FactoryException { throw new FactoryException("Unsupported operation."); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?