use of javax.sql.RowSet in project adempiere by adempiere.
the class WReport method getPrintFormats.
/**
* Get the Print Formats for the table.
* Fill the list and the popup menu
* @param AD_Table_ID table
* @param invoker component to display popup (optional)
*/
private void getPrintFormats(int AD_Table_ID) {
int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
RowSet rowSet = MPrintFormat.getAccessiblePrintFormats(AD_Table_ID, -1, null);
KeyNamePair pp = null;
try {
while (rowSet.next()) {
pp = new KeyNamePair(rowSet.getInt(1), rowSet.getString(2));
if (rowSet.getInt(3) == AD_Client_ID) {
m_list.add(pp);
}
}
} catch (SQLException e) {
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
}
// No Format exists - create it
if (m_list.size() == 0) {
if (pp == null)
// calls launch
createNewFormat(AD_Table_ID);
else
// copies the last format. What if there were several?
copyFormat(pp.getKey(), AD_Client_ID);
} else // One Format exists or no invoker - show it
if (m_list.size() == 1)
launchReport((KeyNamePair) m_list.get(0));
else
// Multiple Formats exist - show selection
// below button
showPopup();
}
use of javax.sql.RowSet in project adempiere by adempiere.
the class SimulatedPickList method print.
/**
* Print result generate for this report
*/
void print() throws Exception {
// Base Language
Language language = Language.getLoginLanguage();
MPrintFormat pf = null;
int pfid = 0;
// get print format for client, else copy system to client
RowSet pfrs = MPrintFormat.getAccessiblePrintFormats(MTable.getTable_ID(X_RV_PP_Product_BOMLine_Storage_TableName), -1, null);
pfrs.next();
pfid = pfrs.getInt("AD_PrintFormat_ID");
if (pfrs.getInt("AD_Client_ID") != 0)
pf = MPrintFormat.get(getCtx(), pfid, false);
else
pf = MPrintFormat.copyToClient(getCtx(), pfid, getAD_Client_ID());
pfrs.close();
if (pf == null)
raiseError("Error: ", "No Print Format");
pf.setLanguage(language);
pf.setTranslationLanguage(language);
// query
MQuery query = new MQuery(X_RV_PP_Product_BOMLine_Storage_TableName);
query.addRestriction(X_T_BOMLine.COLUMNNAME_AD_PInstance_ID, MQuery.EQUAL, AD_PInstance_ID, getParamenterName(X_T_BOMLine.COLUMNNAME_AD_PInstance_ID), getParamenterInfo(X_T_BOMLine.COLUMNNAME_AD_PInstance_ID));
query.addRestriction(X_T_BOMLine.COLUMNNAME_M_Warehouse_ID, MQuery.EQUAL, p_M_Warehouse_ID, getParamenterName(X_T_BOMLine.COLUMNNAME_M_Warehouse_ID), getParamenterInfo(X_T_BOMLine.COLUMNNAME_M_Warehouse_ID));
query.addRestriction(X_T_BOMLine.COLUMNNAME_M_Warehouse_ID, MQuery.EQUAL, p_M_Warehouse_ID, getParamenterName("DateTrx"), getParamenterInfo("DateTrx"));
PrintInfo info = new PrintInfo(X_RV_PP_Product_BOMLine_Storage_TableName, MTable.getTable_ID(X_RV_PP_Product_BOMLine_Storage_TableName), getRecord_ID());
ReportEngine re = new ReportEngine(getCtx(), pf, query, info);
ReportCtl.preview(re);
// records are deleted when process ends
while (re.getView().isDisplayable()) {
Env.sleep(1);
}
}
use of javax.sql.RowSet in project adempiere by adempiere.
the class PrintBOM method print.
/**
* Print result generate for this report
*/
void print() throws Exception {
// Base Language
Language language = Language.getLoginLanguage();
MPrintFormat pf = null;
int pfid = 0;
// get print format for client, else copy system to client
RowSet pfrs = MPrintFormat.getAccessiblePrintFormats(X_RV_PP_Product_BOMLine_Table_ID, -1, null);
pfrs.next();
pfid = pfrs.getInt("AD_PrintFormat_ID");
if (pfrs.getInt("AD_Client_ID") != 0)
pf = MPrintFormat.get(getCtx(), pfid, false);
else
pf = MPrintFormat.copyToClient(getCtx(), pfid, getAD_Client_ID());
pfrs.close();
if (pf == null)
raiseError("Error: ", "No Print Format");
pf.setLanguage(language);
pf.setTranslationLanguage(language);
// query
MQuery query = MQuery.get(getCtx(), AD_PInstance_ID, X_RV_PP_Product_BOMLine_Table_Name);
query.addRestriction("AD_PInstance_ID", MQuery.EQUAL, AD_PInstance_ID);
PrintInfo info = new PrintInfo(X_RV_PP_Product_BOMLine_Table_Name, X_RV_PP_Product_BOMLine_Table_ID, getRecord_ID());
ReportEngine re = new ReportEngine(getCtx(), pf, query, info);
ReportCtl.preview(re);
// records are deleted when process ends
while (re.getView().isDisplayable()) {
Env.sleep(1);
}
}
use of javax.sql.RowSet in project adempiere by adempiere.
the class DB method getRowSet.
// commit
/**
* Get Row Set.
* When a Rowset is closed, it also closes the underlying connection.
* If the created RowSet is transfered by RMI, closing it makes no difference
* @param sql sql
* @param local local RowSet (own connection)
* @return row set or null
*/
public static RowSet getRowSet(String sql) {
// Bugfix Gunther Hoppe, 02.09.2005, vpj-cd e-evolution
// praneet - giving issues with mysql, doing a quick fix for now
CStatementVO info;
if (DB.isOracle() || DB.isPostgreSQL())
info = new CStatementVO(RowSet.TYPE_SCROLL_INSENSITIVE, RowSet.CONCUR_READ_ONLY, DB.getDatabase().convertStatement(sql));
else
info = new CStatementVO(RowSet.TYPE_SCROLL_INSENSITIVE, RowSet.CONCUR_READ_ONLY, sql);
//dete fix convert statement
CPreparedStatement stmt = ProxyFactory.newCPreparedStatement(info);
RowSet retValue = stmt.getRowSet();
close(stmt);
return retValue;
}
use of javax.sql.RowSet in project jdk8u_jdk by JetBrains.
the class JoinRowSetTests method joinRowSetTests0003.
/*
* Join two CachedRowSets specifying a column index to join against
*/
@Test(dataProvider = "createCachedRowSetsToUse")
public void joinRowSetTests0003(CachedRowSet crs, CachedRowSet crs1) throws Exception {
try (JoinRowSet jrs = newInstance()) {
RowSet[] rowsets = { crs, crs1 };
int[] joinCols = { COFFEES_JOIN_COLUMN_INDEX, SUPPLIERS_JOIN_COLUMN_INDEX };
jrs.addRowSet(rowsets, joinCols);
validateResults(jrs);
crs.close();
crs1.close();
}
}
Aggregations