All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hy.xflow.engine.service.impl.TemplateService Maven / Gradle / Ivy

The newest version!
package org.hy.xflow.engine.service.impl;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;

import org.hy.common.Date;
import org.hy.common.Help;
import org.hy.common.PartitionMap;
import org.hy.common.net.CommunicationListener;
import org.hy.common.net.data.CommunicationRequest;
import org.hy.common.net.data.CommunicationResponse;
import org.hy.common.xml.XJava;
import org.hy.common.xml.annotation.Xjava;
import org.hy.xflow.engine.bean.ActivityInfo;
import org.hy.xflow.engine.bean.ActivityRoute;
import org.hy.xflow.engine.bean.ActivityRouteTree;
import org.hy.xflow.engine.bean.Participant;
import org.hy.xflow.engine.bean.Template;
import org.hy.xflow.engine.common.BaseService;
import org.hy.xflow.engine.dao.IActivityInfoDAO;
import org.hy.xflow.engine.dao.IActivityParticipantsDAO;
import org.hy.xflow.engine.dao.IActivityRouteDAO;
import org.hy.xflow.engine.dao.IActivityRouteParticipantsDAO;
import org.hy.xflow.engine.dao.ITemplateDAO;
import org.hy.xflow.engine.service.ITemplateService;





/**
 * 工作流模板的服务层
 *
 * @author      ZhengWei(HY)
 * @createDate  2018-04-19
 * @version     v1.0
 *              v2.0  2020-01-02  1. 添加:工作流引擎集群,同步引擎数据
 */
@Xjava
public class TemplateService extends BaseService implements ITemplateService ,CommunicationListener
{
    
    /** 已解释合成的模板实例的高速缓存。Map.key值是TemplateID */
    private static Map  $CacheTemplates = new Hashtable();
    
    
    
    @Xjava
    private ITemplateDAO                  templateDAO;
    
    @Xjava
    private IActivityInfoDAO              activityInfoDAO;
    
    @Xjava
    private IActivityRouteDAO             activityRouteDAO;
    
    @Xjava
    private IActivityParticipantsDAO      activityParticipantsDAO;
    
    @Xjava
    private IActivityRouteParticipantsDAO activityRouteParticipantsDAO;
    

    
    /**
     * 清空已解释合成的模板实例的高速缓存。
     * 
     * @author      ZhengWei(HY)
     * @createDate  2018-04-25
     * @version     v1.0
     *              v2.0  2020-01-02  1. 添加:工作流引擎集群,同步引擎数据
     */
    public static void clearCache()
    {
        $CacheTemplates.clear();
        
        TemplateService      v_This        = (TemplateService)XJava.getObject("TemplateService");
        CommunicationRequest v_RequestData = new CommunicationRequest();
        v_RequestData.setEventType(    v_This.getEventType());
        v_RequestData.setDataOperation("clearCache");
        v_RequestData.setDataXID(      Date.getNowTime().getFullMilli());
        v_This.clusterSyncFlowCache(v_RequestData);
    }
    
    
    
    /**
     * 查询所有工作流模板信息。内部组合生成关系数据网。
     * 
     * @author      ZhengWei(HY)
     * @createDate  2018-10-31
     * @version     v1.0
     *
     * @return
     */
    @Override
    public synchronized List