Esempio n. 1
0
  /**
   * Method returns true if the given gridTab is a {@link I_C_OLCand} with the correct data
   * destination.
   *
   * @param gridTab
   */
  @Override
  public boolean isPreconditionApplicable(final GridTab gridTab) {
    if (!I_C_OLCand.Table_Name.equals(gridTab.get_TableName())) {
      return false;
    }

    final I_C_OLCand olCand = GridTabWrapper.create(gridTab, I_C_OLCand.class);
    if (olCand.isError()) {
      return false;
    }

    final IInputDataSourceDAO inputDataSourceDAO = Services.get(IInputDataSourceDAO.class);

    final I_AD_InputDataSource dest =
        inputDataSourceDAO.retrieveInputDataSource(
            Env.getCtx(), Contracts_Constants.DATA_DESTINATION_INTERNAL_NAME, false, get_TrxName());
    if (dest == null) {
      return false;
    }
    if (dest.getAD_InputDataSource_ID() != olCand.getAD_DataDestination_ID()) {
      return false;
    }

    return true;
  }
Esempio n. 2
0
  public ProcessHelper setPO(Object o) {
    PO po = InterfaceWrapperHelper.getStrictPO(o);
    if (po != null) {
      setTableId(po.get_Table_ID());
      setRecordId(po.get_ID());
      return this;
    }

    GridTab gridTab = GridTabWrapper.getGridTab(o);
    if (gridTab != null) {
      setTableId(gridTab.get_TableName());
      setRecordId(gridTab.getKeyID(gridTab.getCurrentRow()));
      return this;
    }

    fail("Object " + o + " is not supported in setPO");
    return this;
  }