/** * <p>Retrieve a list of all entities.</p> * @param <T> - type of business object, * @param pAddParam additional param, e.g. already retrieved TableSql * @param pEntityClass entity class * @return list of all business objects or empty list, not null * @throws Exception - an exception */ @Override public final <T> List<T> retrieveList( final Map<String, Object> pAddParam, final Class<T> pEntityClass) throws Exception { String query = evalSqlSelect(pAddParam, pEntityClass) + ";\n"; return retrieveListByQuery(pAddParam, pEntityClass, query); }
/** * <p>Entity's lists with filter "field" (e.g. invoice lines for invoice).</p> * @param <T> - type of entity * @param pAddParam additional param, e.g. already retrieved TableSql * @param pEntity - Entity e.g. an invoice line with filled invoice * @param pFieldFor - Field For name e.g. "invoice" * @return list of business objects or empty list, not null * @throws Exception - an exception */ @Override public final <T> List<T> retrieveListForField( final Map<String, Object> pAddParam, final T pEntity, final String pFieldFor) throws Exception { String whereStr = evalWhereForField(pAddParam, pEntity, pFieldFor); String query = evalSqlSelect(pAddParam, pEntity.getClass()) + whereStr + ";"; @SuppressWarnings("unchecked") Class<T> entityClass = (Class<T>) pEntity.getClass(); return retrieveListByQuery(pAddParam, entityClass, query); }
/** * <p>Retrieve a list of entities.</p> * @param <T> - type of business object, * @param pAddParam additional param, e.g. already retrieved TableSql * @param pEntityClass entity class * @param pQueryConditions Not NULL e.g. "where name='U1' ORDER BY id" * @return list of business objects or empty list, not null * @throws Exception - an exception */ @Override public final <T> List<T> retrieveListWithConditions( final Map<String, Object> pAddParam, final Class<T> pEntityClass, final String pQueryConditions) throws Exception { if (pQueryConditions == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "param_null_not_accepted"); } String query = evalSqlSelect(pAddParam, pEntityClass) + " " + pQueryConditions + ";\n"; return retrieveListByQuery(pAddParam, pEntityClass, query); }