Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Bur2012-08-08 09:44:18 +0000
committerAndreas Bur2012-08-08 09:44:18 +0000
commit70ca0a345774859a5b70fd937af9919e1bd09739 (patch)
tree705921787eccbba7054e6ad865c5f4a95121b517
parent2d5b6855b8f5adff7147771b02e33e1a1700deab (diff)
downloadorg.eclipse.scout.rt-70ca0a345774859a5b70fd937af9919e1bd09739.tar.gz
org.eclipse.scout.rt-70ca0a345774859a5b70fd937af9919e1bd09739.tar.xz
org.eclipse.scout.rt-70ca0a345774859a5b70fd937af9919e1bd09739.zip
bug 386811: varargs for EntityContributions on FormDataStatementBuilder.createSelectStatement
https://bugs.eclipse.org/bugs/show_bug.cgi?id=386811
-rw-r--r--org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilder.java28
1 files changed, 15 insertions, 13 deletions
diff --git a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilder.java b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilder.java
index 27094a5ebc..da25cf797a 100644
--- a/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilder.java
+++ b/org.eclipse.scout.rt.server/src/org/eclipse/scout/rt/server/services/common/jdbc/builder/FormDataStatementBuilder.java
@@ -572,31 +572,33 @@ public class FormDataStatementBuilder implements DataModelConstants {
}
/**
- * Creates a select statement by merging the given entity contribution with the given base statement. This builder's
+ * Creates a select statement by merging the given entity contributions with the given base statement. This builder's
* {@link #getWhereConstraints()} are added as well.
*
* @param stm
* base statement with <selectParts/>, <fromParts/>, <whereParts/>, <groupByParts/>
* or <havingParts/> place holders.
- * @param contribution
- * an entity contribution that is used to replace the markers in the given base statement.
- * @return Returns given base statement having all place holders replaced by the given entity contribution.
+ * @param contributions
+ * entity contributions that are used to replace markers in the given base statement.
+ * @return Returns given base statement having all place holders replaced by the given entity contributions.
* @throws ProcessingException
- * @since 3.8.0
+ * @since 3.8.1
*/
- public String createSelectStatement(String stm, EntityContribution contribution) throws ProcessingException {
- EntityContribution c = contribution;
- if (c == null) {
- c = new EntityContribution();
+ public String createSelectStatement(String stm, EntityContribution... contributions) throws ProcessingException {
+ EntityContribution mergedContribution = new EntityContribution();
+ if (contributions != null) {
+ for (EntityContribution c : contributions) {
+ mergedContribution.add(c);
+ }
}
String where = StringUtility.trim(getWhereConstraints());
if (StringUtility.hasText(where)) {
if (where.toUpperCase().startsWith("AND")) {
where = where.substring(3);
}
- c.getWhereParts().add(where);
+ mergedContribution.getWhereParts().add(where);
}
- return createEntityPart(stm, false, c);
+ return createEntityPart(stm, false, mergedContribution);
}
/**
@@ -1456,7 +1458,7 @@ public class FormDataStatementBuilder implements DataModelConstants {
contrib.getFromParts().add(fromPart);
}
switch (attributeStrategy) {
- //select ... where
+ //select ... where
case BuildQueryOfAttributeAndConstraintOfContext: {
//select
if (attPart != null) {
@@ -1478,7 +1480,7 @@ public class FormDataStatementBuilder implements DataModelConstants {
}
break;
}
- //where / having
+ //where / having
case BuildConstraintOfAttribute: {
if (attPart != null) {
String sql = createSqlPart(aggregationType, attPart, positiveOperation, bindNames, bindValues, plainBind, parentAliasMap);

Back to the top