Code Scratchpad: Eclipse Templates

From iDempiere en
Jump to navigation Jump to search

c_po_get

/**
	 * 	Get specified ${model}
	 *	@param ctx context 
	 *	@param ID
	 *	@return record
	 */
	public static ${model} get (Properties ctx, String trxName, int ID)
	{
		final String whereClause = ${model}.Table_Name + "_ID=?";
		${cursor}${model} retValue = new Query(ctx, ${model}.Table_Name, whereClause, trxName)
			.setParameters(ID)
			.firstOnly();
		return retValue;
	}	//	get

c_toString

/**
	 * toString method
	 */
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("[");
		try {
			sb.append("Class='").append(this.getClass().getName()).append("', ID=").append(get_ID());
			sb.append("]");
			return sb.toString();
		} catch (Exception ex) {
			sb.append("]");
			return sb.toString();
		}
	}