/** * @ Project : NanjingWF * @ File Name : WFBeanUtils.java * @ Date : May 21, 2009 * @ Author : 710000571 * Copyright 2009 Genpact. All Rights Reserved. */ package com.abinbev.workflow.common.utils; import java.util.Iterator; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.abinbev.workflow.common.CommonConstant; import com.abinbev.workflow.core.expeditor.jbpm.interfaces.RequestBean; import com.abinbev.workflow.core.expeditor.jbpm.interfaces.ResponseBean; /** * * @copyright: Copyright 2009 * @company: Genpact * @author: 710000571 * @version: 1.0 * * Modification History: * Date Author Description * ----------------------- * May 21, 2009 710000571 Initialization */ public class WFBeanUtils { private static final Log log = LogFactory.getLog(WFBeanUtils.class); private static final String KEY_PROCESS_INSTANCE_ID = "ProcessInstanceId"; private static final String KEY_TASK_INSTANCE_ID = "TaskInstanceId"; private static final String KEY_PROCESS_DEFINITION_NAME = "ProcessDefinitionName"; private static final String KEY_PROCESS_STATUS = "currentNode"; /** * 從ResponseBean中取得出ProcessInstanceId, TaskInstanceId放入RequestBean中。 * * @param reqBean * @param resBean * @return * @author: 710000571 * @version: 1.0 * * Modification History: * Date Author Description * ----------------------- * May 21, 2009 710000571 Initialization */ @SuppressWarnings("unchecked") public static RequestBean getReqBeanFromRes(RequestBean reqBean, ResponseBean resBean){ Map<Object, Object> map = resBean.getDataContainerMapType(); if(null == map || 0 == map.size() ){ return reqBean; } Iterator it = map.keySet().iterator(); while(it.hasNext()){ String key = (String)it.next(); if (log.isDebugEnabled()) { log.debug("Key [" + key + "] -> value[" + map.get(key) + "]"); } if(KEY_PROCESS_INSTANCE_ID.equalsIgnoreCase(key)){ reqBean.setProcessInstanceId(Long.valueOf(String.valueOf(map.get(key)))); }else if(KEY_TASK_INSTANCE_ID.equalsIgnoreCase(key)){ reqBean.setTaskInstanceId(Long.valueOf(String.valueOf(map.get(key)))); }else if(KEY_PROCESS_DEFINITION_NAME.equalsIgnoreCase(key)){ reqBean.setProcessDefinitionName(String.valueOf(map.get(key))); } } return reqBean; } /** * 從ResponseBean取得ApplicationFormId. * * @param resBean * @return * @author: 710000571 * @version: 1.0 * * Modification History: * Date Author Description * ----------------------- * May 26, 2009 710000571 Initialization */ public static String getApplicationFormId(ResponseBean resBean){ Map<Object, Object> map = resBean.getDataContainerMapType(); if(null == map || 0 == map.size() ){ return null; } if (log.isDebugEnabled()) { log.debug("Key [" + CommonConstant.VAR_BUSUNESS_ID + "] -> value[" + map.get(CommonConstant.VAR_BUSUNESS_ID) + "]"); } String appformId = (String)map.get(CommonConstant.VAR_BUSUNESS_ID); return appformId; } /** * 從ResponseBean取得Process Status. * * @param resBean * @return * @author: 710000571 * @version: 1.0 * * Modification History: * Date Author Description * ----------------------- * May 26, 2009 710000571 Initialization */ @SuppressWarnings("unchecked") public static String getProcessStatus(ResponseBean resBean){ Map<Object, Object> map = resBean.getDataContainerMapType(); if(null == map || 0 == map.size() ){ return null; } Iterator it = map.keySet().iterator(); while(it.hasNext()){ String key = (String)it.next(); if (log.isDebugEnabled()) { log.debug("Key [" + key + "] -> value[" + map.get(key) + "]"); } if(KEY_PROCESS_STATUS.equalsIgnoreCase(key)){ return (String)map.get(key); } } return ""; } }
流程圖(三)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.