Search in sources :

Example 66 with MTable

use of org.compiere.model.MTable in project adempiere by adempiere.

the class EnableNativeSequence method doIt.

//	prepare
protected String doIt() {
    boolean SYSTEM_NATIVE_SEQUENCE = MSysConfig.getBooleanValue("SYSTEM_NATIVE_SEQUENCE", false);
    if (SYSTEM_NATIVE_SEQUENCE) {
        throw new AdempiereException("Native Sequence is Actived");
    }
    setSystemNativeSequence(true);
    boolean ok = false;
    try {
        createSequence("AD_Sequence", null);
        createSequence("AD_Issue", null);
        createSequence("AD_ChangeLog", null);
        //
        final String whereClause = "TableName NOT IN ('AD_Sequence', 'AD_Issue', 'AD_ChangeLog')";
        List<MTable> tables = new Query(getCtx(), X_AD_Table.Table_Name, whereClause, get_TrxName()).setOrderBy("TableName").list();
        for (MTable table : tables) {
            createSequence(table, get_TrxName());
        }
        ok = true;
    } finally {
        if (!ok) {
            setSystemNativeSequence(false);
        }
    }
    return "@OK@";
}
Also used : MTable(org.compiere.model.MTable) Query(org.compiere.model.Query) AdempiereException(org.adempiere.exceptions.AdempiereException)

Example 67 with MTable

use of org.compiere.model.MTable in project adempiere by adempiere.

the class Browser method deleteSelection.

/**
	 * Delete a Selection
	 * @param browseTable
	 * @return
	 */
protected int deleteSelection(IBrowserTable browseTable) {
    MTable table = null;
    MBrowseField fieldKey = m_Browse.getFieldKey();
    if (fieldKey != null)
        if (fieldKey.getAD_View_Column().getAD_Column_ID() > 0)
            table = (MTable) fieldKey.getAD_View_Column().getAD_Column().getAD_Table();
    int records = 0;
    for (int id : getSelectedRowKeys(browseTable)) {
        if (table != null) {
            table.getPO(id, null).deleteEx(true);
            records++;
        }
    }
    return records;
}
Also used : MBrowseField(org.adempiere.model.MBrowseField) MTable(org.compiere.model.MTable)

Aggregations

MTable (org.compiere.model.MTable)67 PO (org.compiere.model.PO)18 ResultSet (java.sql.ResultSet)16 SQLException (java.sql.SQLException)16 PreparedStatement (java.sql.PreparedStatement)15 MColumn (org.compiere.model.MColumn)15 Query (org.compiere.model.Query)13 ArrayList (java.util.ArrayList)10 Properties (java.util.Properties)9 AdempiereException (org.adempiere.exceptions.AdempiereException)7 ADLoginRequest (pl.x3E.adInterface.ADLoginRequest)7 XFireFault (org.codehaus.xfire.fault.XFireFault)5 POInfo (org.compiere.model.POInfo)5 Trx (org.compiere.util.Trx)5 DataField (pl.x3E.adInterface.DataField)5 DataRow (pl.x3E.adInterface.DataRow)5 ModelCRUD (pl.x3E.adInterface.ModelCRUD)5 List (java.util.List)4 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)4 POSaveFailedException (org.adempiere.pipo.exception.POSaveFailedException)4