IDEMPIERE-455 Discover and fix FindBugs problems / Pattern EC_UNRELATED_CLASS_AND_INTERFACE

This commit is contained in:
Carlos Ruiz 2012-12-06 17:17:42 -05:00
parent 47dde2cfe9
commit ad39b3d935
1 changed files with 12 additions and 23 deletions

View File

@ -3,10 +3,6 @@ package org.compiere.model;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.util.Properties; import java.util.Properties;
import org.compiere.model.CalloutEngine;
import org.compiere.model.GridField;
import org.compiere.model.GridTab;
import org.compiere.model.Query;
import org.compiere.util.ArhRuntimeException; import org.compiere.util.ArhRuntimeException;
import org.compiere.util.CCache; import org.compiere.util.CCache;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -17,16 +13,13 @@ import org.compiere.util.Env;
*/ */
public class MAssetType extends X_A_Asset_Type public class MAssetType extends X_A_Asset_Type
{ {
private static final long serialVersionUID = 1L; /**
*
*/
private static final long serialVersionUID = -1371478760221357780L;
public static final String A_ASSET_TYPE_MFX = "MFX"; private static final String A_ASSET_TYPE_MFX = "MFX"; // HARDCODED - you must create a Asset Type with Value=MFX to indicate is Fixed Asset
public static final String A_ASSET_TYPE_INV = "INV"; private static final String A_ASSET_TYPE_INV = "INV"; // HARDCODED - you must create a Asset Type with Value=MFX to indicate is Inventory Object
public static final int A_ASSET_TYPE_ID_MFX = 1;
public static final int A_ASSET_TYPE_ID_INV = 2;
public static final int A_ASSET_TYPE_ID_SUP = 3;
/** Obiecte tert */
public static final int A_ASSET_TYPE_ID_OIN = 4;
public static interface Model public static interface Model
{ {
@ -98,17 +91,13 @@ public class MAssetType extends X_A_Asset_Type
public static boolean isFixedAsset(int A_Asset_ID) public static boolean isFixedAsset(int A_Asset_ID)
{ {
final String whereClause = MAsset.COLUMNNAME_A_Asset_ID+"=?" MAsset asset = MAsset.get(Env.getCtx(), A_Asset_ID, null);
+" AND "+MAsset.COLUMNNAME_A_AssetType+"=?"; return isFixedAsset(asset);
return new Query(Env.getCtx(), MAsset.Table_Name, whereClause, null)
.setParameters(new Object[]{A_Asset_ID, A_ASSET_TYPE_MFX})
.match();
} }
public static boolean isFixedAsset(MAsset asset) public static boolean isFixedAsset(MAsset asset)
{ {
return asset != null && A_ASSET_TYPE_MFX.equals(asset.getA_Asset_Type()); return asset != null && A_ASSET_TYPE_MFX.equals(asset.getA_Asset_Type().getValue());
} }
public static boolean isFixedAssetGroup(Properties ctx, int A_Asset_Group_ID) public static boolean isFixedAssetGroup(Properties ctx, int A_Asset_Group_ID)
@ -150,7 +139,7 @@ public class MAssetType extends X_A_Asset_Type
/** /**
* Validate a Model * Validate a Model
* @param m model * @param m model
* @thorows ContextUserException * @throws ContextUserException
*/ */
public static void validate(Model m) public static void validate(Model m)
{ {