Beispiel #1
0
  /**
   * Is this an Item Product (vs. not a Service, a charge)
   *
   * @return true if product
   */
  public boolean isItem() {
    if (m_isItem != null) return m_isItem.booleanValue();

    m_isItem = Boolean.FALSE;
    if (getM_Product_ID() != 0) {
      MProduct product = MProduct.get(Env.getCtx(), getM_Product_ID());
      if (product.get_ID() == getM_Product_ID() && product.isItem()) m_isItem = Boolean.TRUE;
    }
    return m_isItem.booleanValue();
  } //	isItem
Beispiel #2
0
 /**
  * Perform process.
  *
  * @return Message (text with variables)
  * @throws Exception if not successful
  */
 protected String doIt() throws Exception {
   if (log.isLoggable(Level.INFO)) log.info("M_Product_ID=" + p_M_Product_ID);
   if (p_M_Product_ID == 0)
     throw new AdempiereUserError("@NotFound@: @M_Product_ID@ = " + p_M_Product_ID);
   MProduct product = MProduct.get(getCtx(), p_M_Product_ID);
   if (product.get_ID() != p_M_Product_ID)
     throw new AdempiereUserError("@NotFound@: @M_Product_ID@ = " + p_M_Product_ID);
   //
   if (MCostDetail.processProduct(product, get_TrxName())) return "@OK@";
   return "@Error@";
 } //	doIt
Beispiel #3
0
 /**
  * Get MProduct from Cache
  *
  * @param ctx context
  * @param M_Product_ID id
  * @return MProduct or null
  */
 public static MProduct get(Properties ctx, int M_Product_ID) {
   if (M_Product_ID <= 0) {
     return null;
   }
   Integer key = new Integer(M_Product_ID);
   MProduct retValue = (MProduct) s_cache.get(key);
   if (retValue != null) {
     return retValue;
   }
   retValue = new MProduct(ctx, M_Product_ID, null);
   if (retValue.get_ID() != 0) {
     s_cache.put(key, retValue);
   }
   return retValue;
 } //	get