コード例 #1
0
  protected void updateHelpWidthPreference(String width) {

    if (width != null) {
      Query query =
          new Query(
              Env.getCtx(),
              MTable.get(Env.getCtx(), I_AD_Preference.Table_ID),
              " Attribute=? AND AD_User_ID=? AND AD_Process_ID IS NULL AND PreferenceFor = 'W'",
              null);

      int userId = Env.getAD_User_ID(Env.getCtx());
      MPreference preference =
          query
              .setOnlyActiveRecords(true)
              .setApplyAccessFilter(true)
              .setParameters("HelpController.Width", userId)
              .first();

      if (preference == null || preference.getAD_Preference_ID() <= 0) {

        preference = new MPreference(Env.getCtx(), 0, null);
        preference.set_ValueOfColumn("AD_User_ID", userId); // required set_Value for System=0 user
        preference.setAttribute("HelpController.Width");
      }
      preference.setValue(width);
      preference.saveEx();
    }
  }
コード例 #2
0
  public void actionZoom() {
    int AD_Window_ID = MTable.get(Env.getCtx(), MLocator.Table_ID).getAD_Window_ID();
    if (AD_Window_ID <= 0) AD_Window_ID = 139; // 	hardcoded window Warehouse & Locators
    log.info("");
    //

    MQuery zoomQuery = new MQuery();
    zoomQuery.addRestriction(MLocator.COLUMNNAME_M_Locator_ID, MQuery.EQUAL, getValue());
    zoomQuery.setRecordCount(1); // 	guess

    AEnv.zoom(AD_Window_ID, zoomQuery);
  }
コード例 #3
0
ファイル: ADTableDAO.java プロジェクト: teosarca/metasfresh
 @Override
 public String retrieveWindowName(final Properties ctx, final String tableName) {
   // NOTE: atm we use MTable.get because that's the only place where we have the table cached.
   // In future we shall replace it with something which is database independent.
   final I_AD_Table adTable = MTable.get(ctx, tableName);
   if (adTable == null) {
     return "";
   }
   final I_AD_Window adWindow = adTable.getAD_Window();
   if (adWindow == null) {
     return "";
   }
   final I_AD_Window adWindowTrl = InterfaceWrapperHelper.translate(adWindow, I_AD_Window.class);
   return adWindowTrl.getName();
 }
コード例 #4
0
ファイル: VLocator.java プロジェクト: metasfresh/metasfresh
  /** Action - Zoom */
  @Override
  public void actionZoom() {
    int AD_Window_ID = MTable.get(Env.getCtx(), MLocator.Table_ID).getAD_Window_ID();
    if (AD_Window_ID <= 0) AD_Window_ID = 139; // 	hardcoded window Warehouse & Locators
    log.info("");
    //
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    AWindow frame = new AWindow();

    MQuery zoomQuery = new MQuery();
    zoomQuery.addRestriction(MLocator.COLUMNNAME_M_Locator_ID, Operator.EQUAL, getValue());
    zoomQuery.setRecordCount(1); // 	guess

    if (!frame.initWindow(AD_Window_ID, zoomQuery)) return;
    AEnv.addToWindowManager(frame);
    AEnv.showCenterScreen(frame);
    frame = null;
    setCursor(Cursor.getDefaultCursor());
  } //	actionZoom
コード例 #5
0
  /**
   * Perform process.
   *
   * @return Message
   * @throws Exception if not successful
   */
  protected String doIt() throws Exception {
    String where = " Password IS NOT NULL AND Salt IS NULL ";

    int count = 0;
    boolean isEncrypted = MColumn.isEncrypted(417);

    List<MUser> users =
        MTable.get(getCtx(), MUser.Table_ID).createQuery(where, get_TrxName()).list();
    for (MUser user : users) {
      if (user.getAD_User_ID() == 0) {
        String password =
            DB.getSQLValueString(
                get_TrxName(), "SELECT Password FROM AD_User WHERE AD_User_ID=?", 0);
        if (isEncrypted) password = SecureEngine.decrypt(password);

        user.setPassword(password);
        String sql = "UPDATE AD_User SET Updated=SysDate, UpdatedBy=" + getAD_User_ID();
        if (!Util.isEmpty(password)) {
          sql +=
              ", Password="******", Salt=" + DB.TO_STRING(user.getSalt());
        }
        sql += " WHERE AD_User_ID=0";
        DB.executeUpdateEx(sql, get_TrxName());
        count++;
      } else {
        user.setPassword(user.getPassword());
        count++;
        user.saveEx();
      }
    }

    return "@Updated@ " + count;
  } //	doIt
コード例 #6
0
 public org.adempiere.model.I_AD_View_Column getAxis_Parent_Column() throws RuntimeException {
   return (org.adempiere.model.I_AD_View_Column)
       MTable.get(getCtx(), org.adempiere.model.I_AD_View_Column.Table_Name)
           .getPO(getAxis_Parent_Column_ID(), get_TrxName());
 }
コード例 #7
0
 public org.compiere.model.I_AD_Sequence getAD_Sequence() throws RuntimeException {
   return (org.compiere.model.I_AD_Sequence)
       MTable.get(getCtx(), org.compiere.model.I_AD_Sequence.Table_Name)
           .getPO(getAD_Sequence_ID(), get_TrxName());
 }
コード例 #8
0
 public I_M_Product getM_Product() throws RuntimeException {
   return (I_M_Product)
       MTable.get(getCtx(), I_M_Product.Table_Name).getPO(getM_Product_ID(), get_TrxName());
 }
コード例 #9
0
 public I_M_AttributeSetInstance getM_AttributeSetInstance() throws RuntimeException {
   return (I_M_AttributeSetInstance)
       MTable.get(getCtx(), I_M_AttributeSetInstance.Table_Name)
           .getPO(getM_AttributeSetInstance_ID(), get_TrxName());
 }
コード例 #10
0
ファイル: X_HR_Year.java プロジェクト: jabbp/idempierecartao
 public org.compiere.model.I_C_Year getC_Year() throws RuntimeException {
   return (org.compiere.model.I_C_Year)
       MTable.get(getCtx(), org.compiere.model.I_C_Year.Table_Name)
           .getPO(getC_Year_ID(), get_TrxName());
 }
コード例 #11
0
ファイル: X_TTT_Q_Item.java プロジェクト: tanarat/hsc
 public com.ttt.model.I_TTT_Q_Paper getTTT_Q_Paper() throws RuntimeException {
   return (com.ttt.model.I_TTT_Q_Paper)
       MTable.get(getCtx(), com.ttt.model.I_TTT_Q_Paper.Table_Name)
           .getPO(getTTT_Q_Paper_ID(), get_TrxName());
 }
コード例 #12
0
 /**
  * get Product Planning Columns
  *
  * @return array MColumn
  */
 private MColumn[] getProductPlanningColumns() {
   return MTable.get(getCtx(), MPPProductPlanning.Table_Name).getColumns(false);
 }
コード例 #13
0
 public org.eevolution.model.I_WM_Section_Type getWM_Section_Type() throws RuntimeException {
   return (org.eevolution.model.I_WM_Section_Type)
       MTable.get(getCtx(), org.eevolution.model.I_WM_Section_Type.Table_Name)
           .getPO(getWM_Section_Type_ID(), get_TrxName());
 }
コード例 #14
0
 public org.eevolution.model.I_WM_Area getWM_Area() throws RuntimeException {
   return (org.eevolution.model.I_WM_Area)
       MTable.get(getCtx(), org.eevolution.model.I_WM_Area.Table_Name)
           .getPO(getWM_Area_ID(), get_TrxName());
 }
コード例 #15
0
 public org.adempiere.model.I_AD_Browse getAD_Browse() throws RuntimeException {
   return (org.adempiere.model.I_AD_Browse)
       MTable.get(getCtx(), org.adempiere.model.I_AD_Browse.Table_Name)
           .getPO(getAD_Browse_ID(), get_TrxName());
 }
コード例 #16
0
 public I_M_FreightCost getM_FreightCost() throws RuntimeException {
   return (I_M_FreightCost)
       MTable.get(getCtx(), I_M_FreightCost.Table_Name)
           .getPO(getM_FreightCost_ID(), get_TrxName());
 }
コード例 #17
0
 public I_M_Shipper getM_Shipper() throws RuntimeException {
   return (I_M_Shipper)
       MTable.get(getCtx(), I_M_Shipper.Table_Name).getPO(getM_Shipper_ID(), get_TrxName());
 }
コード例 #18
0
ファイル: X_HR_Job.java プロジェクト: ecartago/opensixen
 public org.eevolution.model.I_HR_Job getNext_Job() throws RuntimeException {
   return (org.eevolution.model.I_HR_Job)
       MTable.get(getCtx(), org.eevolution.model.I_HR_Job.Table_Name)
           .getPO(getNext_Job_ID(), get_TrxName());
 }
コード例 #19
0
ファイル: X_HR_Year.java プロジェクト: jabbp/idempierecartao
 public org.eevolution.model.I_HR_Payroll getHR_Payroll() throws RuntimeException {
   return (org.eevolution.model.I_HR_Payroll)
       MTable.get(getCtx(), org.eevolution.model.I_HR_Payroll.Table_Name)
           .getPO(getHR_Payroll_ID(), get_TrxName());
 }
コード例 #20
0
ファイル: X_HR_Job.java プロジェクト: ecartago/opensixen
 public I_AD_User getSupervisor() throws RuntimeException {
   return (I_AD_User)
       MTable.get(getCtx(), I_AD_User.Table_Name).getPO(getSupervisor_ID(), get_TrxName());
 }
コード例 #21
0
 public I_C_UOM getC_UOM() throws RuntimeException {
   return (I_C_UOM) MTable.get(getCtx(), I_C_UOM.Table_Name).getPO(getC_UOM_ID(), get_TrxName());
 }
コード例 #22
0
ファイル: X_HR_Job.java プロジェクト: ecartago/opensixen
 public org.eevolution.model.I_HR_Department getHR_Department() throws RuntimeException {
   return (org.eevolution.model.I_HR_Department)
       MTable.get(getCtx(), org.eevolution.model.I_HR_Department.Table_Name)
           .getPO(getHR_Department_ID(), get_TrxName());
 }
コード例 #23
0
 public I_M_ChangeNotice getM_ChangeNotice() throws RuntimeException {
   return (I_M_ChangeNotice)
       MTable.get(getCtx(), I_M_ChangeNotice.Table_Name)
           .getPO(getM_ChangeNotice_ID(), get_TrxName());
 }
コード例 #24
0
 public org.eevolution.model.I_PP_ForecastRunMaster getPP_ForecastRunMaster()
     throws RuntimeException {
   return (org.eevolution.model.I_PP_ForecastRunMaster)
       MTable.get(getCtx(), org.eevolution.model.I_PP_ForecastRunMaster.Table_Name)
           .getPO(getPP_ForecastRunMaster_ID(), get_TrxName());
 }
コード例 #25
0
 public org.eevolution.LMX.model.I_LMX_Certificate getLMX_Certificate() throws RuntimeException {
   return (org.eevolution.LMX.model.I_LMX_Certificate)
       MTable.get(getCtx(), org.eevolution.LMX.model.I_LMX_Certificate.Table_Name)
           .getPO(getLMX_Certificate_ID(), get_TrxName());
 }
コード例 #26
0
 public org.eevolution.model.I_PP_Period getPP_Period() throws RuntimeException {
   return (org.eevolution.model.I_PP_Period)
       MTable.get(getCtx(), org.eevolution.model.I_PP_Period.Table_Name)
           .getPO(getPP_Period_ID(), get_TrxName());
 }
コード例 #27
0
 public org.compiere.model.I_C_DocType getC_DocType() throws RuntimeException {
   return (org.compiere.model.I_C_DocType)
       MTable.get(getCtx(), org.compiere.model.I_C_DocType.Table_Name)
           .getPO(getC_DocType_ID(), get_TrxName());
 }
コード例 #28
0
  public static String getReferenceClassName(
      int AD_Table_ID, String columnName, int displayType, int AD_Reference_ID) {
    String referenceClassName = null;
    //
    if (displayType == DisplayType.TableDir
        || (displayType == DisplayType.Search && AD_Reference_ID == 0)) {
      String refTableName =
          MQuery.getZoomTableName(
              columnName); // teo_sarca: BF [ 1817768 ] Isolate hardcoded table direct columns
      referenceClassName = "I_" + refTableName;

      MTable table = MTable.get(Env.getCtx(), refTableName);
      if (table != null) {
        String entityType = table.getEntityType();
        String modelpackage = getModelPackage(entityType);
        if (modelpackage != null) {
          referenceClassName = modelpackage + "." + referenceClassName;
        }
        if (!isGenerateModelGetterForEntity(AD_Table_ID, entityType)) {
          referenceClassName = null;
        }
      } else {
        throw new RuntimeException("No table found for " + refTableName);
      }
    } else if (displayType == DisplayType.Table
        || (displayType == DisplayType.Search && AD_Reference_ID > 0)) {
      // TODO: HARDCODED: do not generate model getter for Fact_Acct.Account_ID
      if (AD_Table_ID == 270 && columnName.equals("Account_ID")) return null;
      // TODO: HARDCODED: do not generate model getter for GL_DistributionLine.Account_ID
      if (AD_Table_ID == 707 && columnName.equals("Account_ID")) return null;
      //
      final String sql =
          "SELECT t.TableName, t.EntityType, ck.AD_Reference_ID"
              + " FROM AD_Ref_Table rt"
              + " INNER JOIN AD_Table t ON (t.AD_Table_ID=rt.AD_Table_ID)"
              + " INNER JOIN AD_Column ck ON (ck.AD_Table_ID=rt.AD_Table_ID AND ck.AD_Column_ID=rt.AD_Key)"
              + " WHERE rt.AD_Reference_ID=?";
      PreparedStatement pstmt = null;
      ResultSet rs = null;
      try {
        pstmt = DB.prepareStatement(sql, null);
        pstmt.setInt(1, AD_Reference_ID);
        rs = pstmt.executeQuery();
        if (rs.next()) {
          final String refTableName = rs.getString(1);
          final String entityType = rs.getString(2);
          final int refDisplayType = rs.getInt(3);
          if (refDisplayType == DisplayType.ID) {
            referenceClassName = "I_" + refTableName;
            String modelpackage = getModelPackage(entityType);
            if (modelpackage != null) {
              referenceClassName = modelpackage + "." + referenceClassName;
            }
            if (!isGenerateModelGetterForEntity(AD_Table_ID, entityType)) {
              referenceClassName = null;
            }
          }
        }
      } catch (SQLException e) {
        throw new DBException(e, sql);
      } finally {
        DB.close(rs, pstmt);
        rs = null;
        pstmt = null;
      }
    } else if (displayType == DisplayType.Location) {
      referenceClassName = "I_C_Location";
    } else if (displayType == DisplayType.Locator) {
      referenceClassName = "I_M_Locator";
    } else if (displayType == DisplayType.Account) {
      referenceClassName = "I_C_ValidCombination";
    } else if (displayType == DisplayType.PAttribute) {
      referenceClassName = "I_M_AttributeSetInstance";
    } else {
      // TODO - Handle other types
      // sb.append("\tpublic I_"+columnName+" getI_").append(columnName).append("(){return null;
      // };");
    }
    //
    return referenceClassName;
  }
コード例 #29
0
 public org.eevolution.LMX.model.I_LMX_Vendor getLMX_Vendor() throws RuntimeException {
   return (org.eevolution.LMX.model.I_LMX_Vendor)
       MTable.get(getCtx(), org.eevolution.LMX.model.I_LMX_Vendor.Table_Name)
           .getPO(getLMX_Vendor_ID(), get_TrxName());
 }
コード例 #30
0
 public org.compiere.model.I_AD_Element getAD_Element() throws RuntimeException {
   return (org.compiere.model.I_AD_Element)
       MTable.get(getCtx(), org.compiere.model.I_AD_Element.Table_Name)
           .getPO(getAD_Element_ID(), get_TrxName());
 }