⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mwfnode.java

📁 Java写的ERP系统
💻 JAVA
字号:
/******************************************************************************
 * The contents of this file are subject to the   Compiere License  Version 1.1
 * ("License"); You may not use this file except in compliance with the License
 * You may obtain a copy of the License at http://www.compiere.org/license.html
 * Software distributed under the License is distributed on an  "AS IS"  basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 * The Original Code is                  Compiere  ERP & CRM  Business Solution
 * The Initial Developer of the Original Code is Jorg Janke  and ComPiere, Inc.
 * Portions created by Jorg Janke are Copyright (C) 1999-2002 Jorg Janke, parts
 * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
 * Contributor(s): ______________________________________.
 *****************************************************************************/
package org.compiere.model;

import java.util.*;
import java.sql.*;
import java.awt.Point;

import org.compiere.util.*;

/**
 *	Workflow Node
 *
 * 	@author 	Jorg Janke
 * 	@version 	$Id: MWFNode.java,v 1.1 2002/12/05 05:41:31 jjanke Exp $
 */
public class MWFNode extends PO
{
	/**
	 * 	Constructor
	 * 	@param ctx context
	 * 	@param rs result set to load info from
	 */
	public MWFNode(Properties ctx, ResultSet rs)
	{
		super (ctx, rs);
		Log.trace(Log.l5_DData, "MWFNode " + getAD_WF_Node_ID());
		loadNext();
		loadTrl();
	}	//	MWFNode

	/**	Next Modes				*/
	private ArrayList		m_next = new ArrayList();
	/**	Translated Name			*/
	private String			m_name_trl = null;
	/**	Translated Description	*/
	private String			m_description_trl = null;
	/**	Translated Help			*/
	private String			m_help_trl = null;
	/**	Translation Flag		*/
	private boolean			m_translated = false;

	/**
	 *  Initialize and return PO_Info
	 *  @param ctx context
	 *  @return POInfo
	 */
	protected POInfo initPO (Properties ctx)
	{
		int AD_Table_ID = 129;		//	Trl = 130
		POInfo poi = POInfo.getPOInfo (ctx, AD_Table_ID);
		return poi;
	}	//	InitPO

	/**
	 * 	Load Next
	 */
	private void loadNext()
	{
		String sql = "SELECT * FROM AD_WF_NodeNext WHERE AD_WF_Node_ID=?";
		try
		{
			PreparedStatement pstmt = DB.prepareStatement(sql);
			pstmt.setInt(1, getID());
			ResultSet rs = pstmt.executeQuery();
			while (rs.next())
				m_next.add(new MWFNodeNext (getCtx(), rs));
			rs.close();
			pstmt.close();
		}
		catch (SQLException e)
		{
			Log.error("M_WorkFlow.loadNext", e);
		}
		Log.trace(Log.l6_Database, "MWFNode.loadNext #" + m_next.size());
	}	//	loadNext

	/**
	 * 	Load Translation
	 */
	private void loadTrl()
	{
		if (Env.isBaseLanguage(getCtx(), "AD_Workflow") || getID() == 0)
			return;
		String sql = "SELECT Name, Description, Help FROM AD_WF_Node_Trl WHERE AD_WF_Node_ID=? AND AD_Language=?";
		try
		{
			PreparedStatement pstmt = DB.prepareStatement(sql);
			pstmt.setInt(1, getID());
			pstmt.setString(2, Env.getAD_Language(getCtx()));
			ResultSet rs = pstmt.executeQuery();
			if (rs.next())
			{
				m_name_trl = rs.getString(1);
				m_description_trl = rs.getString(2);
				m_help_trl = rs.getString(3);
				m_translated = true;
			}
			rs.close();
			pstmt.close();
		}
		catch (SQLException e)
		{
			Log.error("MWFNode.loadTrl", e);
		}
		Log.trace(Log.l6_Database, "MWFNode.loadTrl " + m_translated);
	}	//	loadTrl

	/**
	 * 	Get Number of Next Nodes
	 * 	@return number of next nodes
	 */
	public int getNextNodeCount()
	{
		return m_next.size();
	}	//	getNextNodeCount

	/**
	 * 	Get the next nodes
	 * 	@return array of next nodes
	 */
	public MWFNodeNext[] getNextNodes()
	{
		MWFNodeNext[] retValue = new MWFNodeNext [m_next.size()];
		m_next.toArray(retValue);
		return retValue;
	}	//	getNextNodes

	/*************************************************************************/

	/**
	 * 	Get Node ID
	 * 	@return node id
	 */
	public int getAD_WF_Node_ID()
	{
		Integer ii = (Integer)getValue("AD_WF_Node_ID");
		if (ii != null)
			return ii.intValue();
		return 0;
	}	//	getAD_WF_Node_ID

	/**
	 * 	Get Name
	 * 	@return Name
	 */
	public String getName()
	{
		return (String)getValue("Name");
	}	//	getName

	/**
	 * 	Get Name
	 * 	@param translated translated
	 * 	@return Name
	 */
	public String getName(boolean translated)
	{
		if (translated && m_translated)
			return m_name_trl;
		return getName();
	}	//	getName

	/**
	 * 	Get Description
	 * 	@return Description
	 */
	public String getDescription()
	{
		return (String)getValue("Description");
	}	//	getDescription

	/**
	 * 	Get Description
	 * 	@param translated translated
	 * 	@return Description
	 */
	public String getDescription(boolean translated)
	{
		if (translated && m_translated)
			return m_description_trl;
		return getDescription();
	}	//	getDescription

	/**
	 * 	Get Help
	 * 	@return Help
	 */
	public String getHelp()
	{
		return (String)getValue("Help");
	}	//	getHelp

	/**
	 * 	Get Help
	 * 	@param translated translated
	 * 	@return Name
	 */
	public String getHelp(boolean translated)
	{
		if (translated && m_translated)
			return m_help_trl;
		return getHelp();
	}	//	getHelp

	/**
	 * 	Get AD_Workflow_ID (parent)
	 * 	@return AD_Workflow_ID
	 */
	public int getAD_Workflow_ID()
	{
		Integer ii = (Integer)getValue("AD_Workflow_ID");
		if (ii != null)
			return ii.intValue();
		return 0;
	}	//	get

	/**
	 * 	Get Action
	 * 	@return Action
	 */
	public String getAction()
	{
		return (String)getValue("Action");
	}	//	get Action

	/**
	 * 	Get AD_Window_ID
	 * 	@return AD_Window_ID
	 */
	public int getAD_Window_ID()
	{
		Integer ii = (Integer)getValue("AD_Window_ID");
		if (ii != null)
			return ii.intValue();
		return 0;
	}	//	getAD_Window_ID

	/**
	 * 	Get WorkFlow_ID
	 * 	@return WorkFlow_ID
	 */
	public int getWorkFlow_ID()
	{
		Integer ii = (Integer)getValue("WorkFlow_ID");
		if (ii != null)
			return ii.intValue();
		return 0;
	}	//	getWorkFlow_ID

	/**
	 * 	Get AD_Task_ID
	 * 	@return AD_Task_ID
	 */
	public int getAD_Task_ID()
	{
		Integer ii = (Integer)getValue("AD_Task_ID");
		if (ii != null)
			return ii.intValue();
		return 0;
	}	//	getAD_Task_ID

	/**
	 * 	Get AD_Process_ID
	 * 	@return AD_Process_ID
	 */
	public int getAD_Process_ID()
	{
		Integer ii = (Integer)getValue("AD_Process_ID");
		if (ii != null)
			return ii.intValue();
		return 0;
	}	//	getAD_Process_ID

	/**
	 * 	Get AD_Form_ID
	 * 	@return AD_Form_ID
	 */
	public int getAD_Form_ID()
	{
		Integer ii = (Integer)getValue("AD_Form_ID");
		if (ii != null)
			return ii.intValue();
		return 0;
	}	//	getAD_Form_ID

	/**
	 * 	Get XPosition
	 * 	@return Xposition
	 */
	public int getXposition()
	{
		Integer ii = (Integer)getValue("Xposition");
		if (ii != null)
			return ii.intValue();
		return 0;
	}	//	getXposition

	/**
	 * 	Set XPosition
	 * 	@param xPosition x
	 */
	public void setXposition (int xPosition)
	{
		setValue("Xposition", new Integer(xPosition));
	}	//	setXposition

	/**
	 * 	Get YPosition
	 * 	@return YPosition
	 */
	public int getYposition()
	{
		Integer ii = (Integer)getValue("Yposition");
		if (ii != null)
			return ii.intValue();
		return 0;
	}	//	getYposition

	/**
	 * 	Set YPosition
	 * 	@param yPosition y
	 */
	public void setYposition (int yPosition)
	{
		setValue("Yposition", new Integer(yPosition));
	}	//	setXposition

	/**
	 * 	Set Position
	 * 	@param position point
	 */
	public void setPosition (Point position)
	{
		setXposition(position.x);
		setYposition(position.y);
	}	//	setPosition

	/**
	 * 	Get Position
	 * 	@return position point
	 */
	public Point getPosition ()
	{
		return new Point (getXposition(), getYposition());
	}	//	getPosition

}	//	M_WFNext

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -