Use spring+ Viewer mode to process status changes and mail delivery for performance assessment processes

Source: Internet
Author: User

performance evaluation process after the completion of the monthly performance plan of all employees, the system automatically according to the assessment of the relationship table (tree structure, parent node is the sub-node of the assessment, the director of the Department for the lowest level of assessment) to launch a task, the lowest level of the assessment of the information assembled into the table into the approval form, Parallel to the bottom-level assessment of the human-parallel sub-task. At the end of the final parallel assessment, the system automatically assigns the new sub-task to the top level of the assessment of the bottom-most level, and summarizes the assessment information of all the parallel lowest assessment persons as the approval form, thus iterating until the final evaluation relationship is reached on the platform, and the process ends. Since the process is extremely special, is not ordinary parallel or serial, nor ordinary sub-task or sign, in addition to the initiation node, the end node, there is only one assessment node, all assessment activities are considered to evaluate the node sub-task, jbpm that all sub-tasks are parallel relationships, Use basic information, such as the rating relationships table, to identify hierarchical relationships for different subtasks in business logic. Due to the inability to use a unified process flow, after designing the process and form, a separate design engine drives the process and updates the underlying information table and sends the message as the process runs.

Separate process engine settings, updates to the employee Performance Base information table, and message delivery are developed by different programmers. The process engine will notify the corresponding logical Update table and send the message as necessary during the process of driving the process. In developing the engine, I use the observer pattern to refactor the process so that the development of the update employee performance base information and the message sending logic is done independently, and the coupling of the code is further reduced.

There is a situation in the system: a function point triggered by the action will cause the relevant one or more function points in the business of the corresponding data processing. And in the end there are several functional points to make corresponding, depends on the customer implementation of what needs to respond to specific functional points.

For example: A function point of a business will trigger the B, C, D three function points to respond, and the customer subscribed to which function points is unknown, perhaps the customer does not need C function point, to a function point business operations to respond to only B, D.

According to the above requirements can be drawn, the design should be as loosely coupled as possible to maintain the independence of the functional points. The observer pattern was bound to jump out.

Our system uses the Spring framework as a whole for bean management. The way that spring uses configuration files to load specific classes-the equivalent of a packaged factory-makes the code more flexible. In the same way, the application of the observer pattern can be much more flexible by borrowing the platform provided by the spring framework.

First, we define an abstract observer.

/** * TODO (Description class Responsibilities) * @author Chao.gao * @date November 30, 2015 Morning 8:50:59 * @version <b>1.0.0</b> */public interface Baseobserverhandler extends Observer {}

 

/** * a class can implement the <code>observer</code>  interface when it * wants to be informed of changes in  observable objects. * *  @author   Chris Warth *  @version  %i%,  %G% *  @see      java.util.Observable *  @since     JDK1.0 */public interface Observer {    /**      * This method is called whenever the observed object  Is changed. an     * application calls an <tt> Observable</tt> object ' S     * <code>notifyobservers</code > method to have all the object ' s     *  observers notified of the change.     *     *  @param     o     the observable object.     * @ Param   arg   an argument passed to the <code> notifyobservers</code>     *                  method.     */     void update (Observable o, object arg);}

Specific observers:

public class Endprocessmailsenthandler implements baseobserverhandler{//actual Update method, specifically implemented slightly}

in observer mode, the target role is called by the client program and notifies the specific observer role through the target role. In the traditional observer pattern, a list of observer roles is maintained in the target role, and the observer role in the list is added and maintained by other programs-which means that changes to the Observer list can cause code changes. This is avoided by registering the observer role with the Spring framework configuration.

/** * todo (Description of duties of Class)  *  @author  chao.gao *  @date  2015 November 27   PM 4 :15:36 *  @version  <b>1.0.0</b> */public abstract class  baseobservedhandler extends observable {private list<baseobserverhandler>  observerhanlers;/** *  operated by the Observer  *  @author  chao.gao *  @date  2015 November 27   Afternoon 4:18:56 *  @param  context */public void observedopertion ( Evaluationporcesscontext context)  {if  (observerhanlers == null | |  observerhanlers.isempty ()) return;for  (baseobserverhandler baseobserverhandler :  observerhanlers)  {super.addobserver (Baseobserverhandler);} Super.notifyobservers (context);} /** *  Get observerhanlers *  @return  List<BaseObserverHandler> */public  List<baseobserverhandler> getobserverhanlers ()  {return obServerhanlers;} /** *  setting observerhanlers *  @param  observerHanlers */public void  Setobserverhanlers (list<baseobserverhandler> observerhanlers)  {this.observerhanlers =  observerhanlers;}}

Below isSpringFrameworkA fragment of a configuration file-it should appear in a specific client program that uses the target roleSpringthe configuration file. It stores the aliases of specific observers inaListinside, usingSpringinjects a target role for the build.

As follows:

<bean id= "Endprocessservice" class= " Com.fx.oa.module.per.evaluation.workflow.server.service.impl.EndProcessService "><property name=" Jbpmoperatorservice "ref=" Jbpmoperatorservice "/><property name=" Evaluationprocessservice "ref=" Evaluationprocessservice "/><property name=" observerhanlers "><list><ref bean=" EndProcessHandler "/><ref bean=" Endprocessmailsenthandler "/><ref bean=" Endprocesssaveformhandler "/></list> </property></bean>


This article is from the "Jiangnan Miner Technology Space" blog, please be sure to keep this source http://jncumter.blog.51cto.com/812546/1747203

Use spring+ Viewer mode to process status changes and mail delivery for performance assessment processes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.