Commit Graph
106 Commits
Author SHA1 Message Date
Jacques Le Roux 2b712efb98 No functional changes, simple code refactoring around UtilValidate.is(Not)Empty()
Changes implementation of UtilValidate.isEmpty() for Collection and Map by using isEmpty() instead of c.size() == 0). It's more clear and as efficient. Removes also useless parentheses there.

Makes use of UtilValidate.is(Not)Empty() everywhere it makes senses. This for 2 reasons:
* Make the code more readable by replacing the (!)null/isEmpty pattern.
* Avoid possible NPEs when only isEmpty() was used (after Entity.find... for instance). I found a lot of cases (242 today) where isEmpty() could perhaps be replaced in Framework. But I guess no NPE checks were missing there and anyway it was too much for me to check them all... So I only did the relevant changes in Applications...



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1169478 13f79535-47bb-0310-9956-ffa450edef68
2011-09-11 17:06:11 +00:00
Adam Heath 32f514d948 FIX: Protect against a null return from getFieldDefs().
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1139888 13f79535-47bb-0310-9956-ffa450edef68
2011-06-26 18:11:32 +00:00
Jacques Le Roux c66be987ed This version compiles under all Java version (so far :/ )
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1082475 13f79535-47bb-0310-9956-ffa450edef68
2011-03-17 12:52:27 +00:00
Jacques Le Roux 9c22457c44 Revert partially r1076852 (only http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Planner.java?view=diff&r1=1076852&r2=1076853&pathrev=1076853)
This is preventing some java version to compile (So far at least 1.6.0_14 and 1.6.0_17 fail. It's ok with 1.6.0_23 and 1.6.0_24)

Marco mades this change recently in his warnings effort. But I don't see anything in Eclipse nor while building. So I'm reverting this trivial change



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1081912 13f79535-47bb-0310-9956-ffa450edef68
2011-03-15 19:19:22 +00:00
Marco Risaliti a808eb8bcc Remove some warning in ValuesTest (OFBIZ-4102)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1076860 13f79535-47bb-0310-9956-ffa450edef68
2011-03-03 22:44:27 +00:00
Marco Risaliti 2a0e24a809 Remove some warning in SQLTest (OFBIZ-4102)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1076857 13f79535-47bb-0310-9956-ffa450edef68
2011-03-03 22:42:59 +00:00
Marco Risaliti 5000fb8e1c Remove some unused variable in ConditionsTest (OFBIZ-4102)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1076855 13f79535-47bb-0310-9956-ffa450edef68
2011-03-03 22:41:31 +00:00
Marco Risaliti b7eb96d443 Remove some warning in Main/Planner/Value (OFBIZ-4102)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1076853 13f79535-47bb-0310-9956-ffa450edef68
2011-03-03 22:37:01 +00:00
Marco Risaliti 0154f18aa0 Remove some warning in NumberValue (OFBIZ-4102)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1076852 13f79535-47bb-0310-9956-ffa450edef68
2011-03-03 22:32:41 +00:00
Marco Risaliti 3927aa0273 Remove some warning of javacc classes after upgrade javacc to version 5.0 (OFBIZ-4102)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1076779 13f79535-47bb-0310-9956-ffa450edef68
2011-03-03 20:29:34 +00:00
Marco Risaliti 2eda5a9dca Remove unused variable/import in SelectTest (OFBIZ-4102)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1076437 13f79535-47bb-0310-9956-ffa450edef68
2011-03-02 22:22:33 +00:00
Marco Risaliti 7f178509c0 Remove a unused import in SQLSelect (OFBIZ-4102)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1069111 13f79535-47bb-0310-9956-ffa450edef68
2011-02-09 21:13:20 +00:00
Marco Risaliti 1bae5e4464 Remove a unused import in SQLIndex (OFBIZ-4102)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1069109 13f79535-47bb-0310-9956-ffa450edef68
2011-02-09 21:12:36 +00:00
Marco Risaliti 8c5cd799ea Add a @SuppressWarning("serial") in ParameterizedConditionException (OFBIZ-4102)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1069108 13f79535-47bb-0310-9956-ffa450edef68
2011-02-09 21:11:33 +00:00
Marco Risaliti 0f95781ee0 Remove a unused import in AggregateFunction (OFBIZ-4102)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1069106 13f79535-47bb-0310-9956-ffa450edef68
2011-02-09 21:10:03 +00:00
Scott Gray 75b0b1c1e3 Remove unnecessary semicolons
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1044917 13f79535-47bb-0310-9956-ffa450edef68
2010-12-12 20:43:03 +00:00
Scott Gray bdd23c22d5 Add missing override annotations
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1044913 13f79535-47bb-0310-9956-ffa450edef68
2010-12-12 20:41:27 +00:00
Adam Heath d06f72f7f9 FEATURE: Start of union support; parsing isn't tested yet.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981640 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:44:20 +00:00
Adam Heath 872db5befd FEATURE: Start of aggregate function support.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981639 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:44:12 +00:00
Adam Heath 550d275781 FEATURE: Add count-all variant that doesn't require a table name.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981638 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:44:05 +00:00
Adam Heath ca01d94d2a FEATURE: Add support for CREATE INDEX.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981637 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:44:00 +00:00
Adam Heath 56c7c3391a FEATURE: ORDER BY now supports any ConstantValue, which includes any
function, and also math operations.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981636 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:43:53 +00:00
Adam Heath f7ad0f1ea6 Allow external callers to parse individual OrderByItem instances.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981634 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:43:42 +00:00
Adam Heath 055e49cb5a FEATURE: Add support for NULLS FIRST/LAST in ORDER BY.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981633 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:43:36 +00:00
Adam Heath 8ebec8e647 OPTIMIZE: Remove descending and orderingSet booleans, they weren't being used
properly.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981632 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:43:30 +00:00
Adam Heath 5147b48afa TESTS: Ensure that no more statements has been parsed.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981631 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:43:25 +00:00
Adam Heath eebce0b77f BUG FIX: Fix parsing of -/+ style order by prefixes.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981630 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:43:19 +00:00
Adam Heath 6772e47dd6 FEATURE: Add basic implementations of the available visitors.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981629 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:43:13 +00:00
Adam Heath 2923612353 OPTIMIZE: Remove unused variable i from Select().
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981628 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:43:08 +00:00
Adam Heath f150eecfb9 BUG FIX: CountAll needs to remember the tableName; also implement
equals.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981627 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:43:02 +00:00
Adam Heath 46b66d2bd2 BUG FIX: Fix correct formatting around the operator.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981626 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:42:55 +00:00
Adam Heath 33809facfe TESTS: Start adding low-level object unit tests.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981625 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:42:49 +00:00
Adam Heath c9f9555c25 No longer use ON in relation settings; instead, use MAP, which makes the
sql a little bit simpler.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981624 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:42:39 +00:00
Adam Heath 1581156412 TESTS: Test reparsing of all statements.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981623 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:42:33 +00:00
Adam Heath a9aa86c234 BUG FIX: OFFSET/LIMIT have to be after ORDER BY/GROUP BY.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981622 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:42:28 +00:00
Adam Heath 1fc630261e BUG FIX: Fix toString with multiple RELATION, they should not be
separated by commas.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981621 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:42:23 +00:00
Adam Heath 3ade64a656 OPTIMIZE: KeyMap no longer extends Atom, so no longer has any appendTo variants.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981620 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:42:17 +00:00
Adam Heath 0864fca12f BUG FIX: Fix multiple keymaps in a relation, wasn't separated by AND.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981619 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:42:11 +00:00
Adam Heath bc6a4b7870 Introduce a new method, getDefaultName(), so that null alias logic
doesn't happen in the constructor.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981618 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:42:06 +00:00
Adam Heath f8e091775c FEATURE: Make public wrappers around several internal methods.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981617 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:42:00 +00:00
Adam Heath 3929451368 FEATURE: Create a new StaticValue function, based on the contents of
FieldDef.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981616 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:41:55 +00:00
Adam Heath 81a56ac59c REFACTOR: Move FieldAll call to a new function, SelectField.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981615 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:41:50 +00:00
Adam Heath e544bd6be0 REFACTOR: Optimize select AS support, so it is only required in one place.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981614 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:41:44 +00:00
Adam Heath 806332cc89 REFACTOR: Optimize FieldDef, so that the FieldDef object instantiation only
happens in one place.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981613 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:41:39 +00:00
Adam Heath b98105c65f REFACTOR: Abstract out FieldAll so it can be called externally.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981612 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:41:34 +00:00
Adam Heath 54c6cb0f16 FEATURE: Add static valueOf methods.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981611 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:41:28 +00:00
Adam Heath 0038f309a5 FORMAT: Re-indent; couldn't find a standard for indentation, so this is an
attempt to have some sort of common pattern for doing so.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981610 13f79535-47bb-0310-9956-ffa450edef68
2010-08-02 17:41:23 +00:00
Scott Gray 4448c4a866 No functional changes, just removing a whole bunch of unused imports and reorganizing them along the way.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@981019 13f79535-47bb-0310-9956-ffa450edef68
2010-07-31 08:28:34 +00:00
Adam Heath cbd11cf3b0 Revert wrongly committed 950258
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@950277 13f79535-47bb-0310-9956-ffa450edef68
2010-06-01 22:00:26 +00:00
Adam Heath 69c2d455f3 sql foo
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@950258 13f79535-47bb-0310-9956-ffa450edef68
2010-06-01 21:46:44 +00:00