Search in sources :

Example 1 with X_A_Asset

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

the class WebInfo method getAssets.

//	getPayments
/**
	 * 	Get Active Assets if not Credit Stop and EMail is verified
	 *	@return payments of BP
	 */
public ArrayList<X_A_Asset> getAssets() {
    m_infoMessage = null;
    ArrayList<X_A_Asset> list = new ArrayList<X_A_Asset>();
    if (m_wu != null) {
        if (m_wu.isCreditStopHold())
            return list;
        if (!m_wu.isEMailVerified())
            return list;
    }
    if (m_wu != null && !m_wu.hasBPAccess(X_AD_UserBPAccess.BPACCESSTYPE_AssetsDownload, null)) {
        log.info("No Access");
        return list;
    }
    String sql = "SELECT * FROM A_Asset WHERE C_BPartner_ID=? AND IsActive='Y' ORDER BY Name";
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
        pstmt = DB.prepareStatement(sql, null);
        pstmt.setInt(1, getC_BPartner_ID());
        rs = pstmt.executeQuery();
        while (rs.next()) list.add(new X_A_Asset(m_ctx, rs, null));
    } catch (Exception e) {
        log.log(Level.SEVERE, sql, e);
    } finally {
        DB.close(rs, pstmt);
        rs = null;
        pstmt = null;
    }
    log.fine("#" + list.size());
    return list;
}
Also used : ArrayList(java.util.ArrayList) ResultSet(java.sql.ResultSet) X_A_Asset(org.compiere.model.X_A_Asset) PreparedStatement(java.sql.PreparedStatement)

Aggregations

PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 ArrayList (java.util.ArrayList)1 X_A_Asset (org.compiere.model.X_A_Asset)1