public int countSelectedResourcesWhere(String sqlWhere) { // read all where count String sql = singleStorageSql.getNumRowsSql(m_resourceTableName, sqlWhere); List results = m_sql.dbRead(sql, null, new SqlReader() { public Object readSqlResultRecord(ResultSet result) { try { int count = result.getInt(1); return Integer.valueOf(count); } catch (SQLException ignore) { return null; } } }); if (results.isEmpty()) return 0; return ((Integer) results.get(0)).intValue(); }
/** * Check if a Resource by this id exists. * * @param id * The id. * @return true if a Resource by this id exists, false if not. */ public boolean checkResource(String id) { // just see if the record exists String sql = singleStorageSql.getResourceIdSql(m_resourceTableIdField, m_resourceTableName); Object fields[] = new Object[1]; fields[0] = caseId(id); List ids = m_sql.dbRead(sql, fields, null); return (!ids.isEmpty()); }
String sql = singleStorageSql.getXmlAndFieldSql(m_resourceTableIdField, m_resourceTableName);
public List getAllResources(int first, int last) { Object[] fields = singleStorageSql.getXmlFields(first, last); List xml = null; String sql = singleStorageSql.getXmlSql(m_resourceTableIdField, m_resourceTableName, first, last); xml = loadResources(sql, fields); List rv = new Vector(); // process all result xml into user objects if (!xml.isEmpty()) { for (int i = 0; i < xml.size(); i++) { Entity entry = (Entity) xml.get(i); if (entry != null) rv.add(entry); } } return rv; }
String statement = singleStorageSql.getDeleteSql(m_resourceTableIdField, m_resourceTableName); statement = singleStorageSql.getDeleteLocksSql();
/** * Get all Resources where the given field matches the given value. * * @param field * The db field name for the selection. * @param value * The value to select. * @return The list of all Resources that meet the criteria. */ public List getAllResourcesWhere(String field, String value) { // read all users from the db String sql = singleStorageSql.getXmlSql(field, m_resourceTableName); Object[] fields = new Object[1]; fields[0] = value; // %%% + "order by " + m_resourceTableOrderField + " asc"; return loadResources(sql, fields); }
String statement = singleStorageSql.getDeleteLocksSql();
public List getAllResourcesWhereLike(String field, String value) { String sql = singleStorageSql.getXmlLikeSql(field, m_resourceTableName); Object[] fields = new Object[1]; fields[0] = value; // %%% + "order by " + m_resourceTableOrderField + " asc"; return loadResources(sql, fields); }
/** * Get all Resources where the given field matches the given value. * * @param field * The db field name for the selection. * @param value * The value to select. * @return The list of all Resources that meet the criteria. */ public List getAllResourcesWhere(String selectBy, String selectByValue, String orderBy, int first, int pageSize) { // read all users from the db String sql = singleStorageSql.getXmlWhereLimitSql(selectBy, orderBy, m_resourceTableName, first, pageSize); Object[] fields = new Object[1]; fields[0] = selectByValue; // %%% + "order by " + m_resourceTableOrderField + " asc"; return loadResources(sql, fields); }
String statement = singleStorageSql.getInsertLocks();
public List getAllResources(int first, int last) { Object[] fields = singleStorageSql.getXmlFields(first, last); List xml = null; String sql = singleStorageSql.getXmlSql(m_resourceTableIdField, m_resourceTableName, first, last); xml = loadResources(sql, fields); List rv = new Vector(); // process all result xml into user objects if (!xml.isEmpty()) { for (int i = 0; i < xml.size(); i++) { Entity entry = (Entity) xml.get(i); if (entry != null) rv.add(entry); } } return rv; }
String statement = singleStorageSql.getDeleteSql(m_resourceTableIdField, m_resourceTableName); statement = singleStorageSql.getDeleteLocksSql();
/** * Get all Resources where the given field matches the given value. * * @param field * The db field name for the selection. * @param value * The value to select. * @return The list of all Resources that meet the criteria. */ public List getAllResourcesWhere(String field, String value) { // read all users from the db String sql = singleStorageSql.getXmlSql(field, m_resourceTableName); Object[] fields = new Object[1]; fields[0] = value; // %%% + "order by " + m_resourceTableOrderField + " asc"; return loadResources(sql, fields); }
String statement = singleStorageSql.getDeleteLocksSql();
public List getAllResourcesWhereLike(String field, String value) { String sql = singleStorageSql.getXmlLikeSql(field, m_resourceTableName); Object[] fields = new Object[1]; fields[0] = value; // %%% + "order by " + m_resourceTableOrderField + " asc"; return loadResources(sql, fields); }
/** * Get all Resources where the given field matches the given value. * * @param field * The db field name for the selection. * @param value * The value to select. * @return The list of all Resources that meet the criteria. */ public List getAllResourcesWhere(String selectBy, String selectByValue, String orderBy, int first, int pageSize) { // read all users from the db String sql = singleStorageSql.getXmlWhereLimitSql(selectBy, orderBy, m_resourceTableName, first, pageSize); Object[] fields = new Object[1]; fields[0] = selectByValue; // %%% + "order by " + m_resourceTableOrderField + " asc"; return loadResources(sql, fields); }
String statement = singleStorageSql.getInsertLocks();
public List getAllResources(int first, int last) { Object[] fields = singleStorageSql.getXmlFields(first, last); List xml = null; String sql = singleStorageSql.getXmlSql(m_resourceTableIdField, m_resourceTableName, first, last); xml = loadResources(sql, fields); List rv = new Vector(); // process all result xml into user objects if (!xml.isEmpty()) { for (int i = 0; i < xml.size(); i++) { Entity entry = (Entity) xml.get(i); if (entry != null) rv.add(entry); } } return rv; }
String statement = singleStorageSql.getDeleteSql(m_resourceTableIdField, m_resourceTableName); statement = singleStorageSql.getDeleteLocksSql();
public List getAllResources() { List all = new Vector(); // read all users from the db List xml = null; String sql = singleStorageSql.getXmlSql(m_resourceTableName); xml = loadResources(sql, null); // %%% + "order by " + m_resourceTableOrderField + " asc"; // process all result xml into user objects if (!xml.isEmpty()) { for (int i = 0; i < xml.size(); i++) { Entity entry = (Entity) xml.get(i); if (entry != null) all.add(entry); } } return all; }