You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2013/07/31 10:13:04 UTC
[19/22] eliminate checkstyle warnings
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinSelectContext.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinSelectContext.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinSelectContext.java
index c4768fe..c84687f 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinSelectContext.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinSelectContext.java
@@ -36,8 +36,7 @@ import org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLContextType;
import org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLJoinContextView;
import org.apache.olingo.odata2.processor.core.jpa.ODataExpressionParser;
-public class JPQLJoinSelectContext extends JPQLSelectContext implements
- JPQLJoinContextView {
+public class JPQLJoinSelectContext extends JPQLSelectContext implements JPQLJoinContextView {
private List<JPAJoinClause> jpaJoinClauses = null;
@@ -54,8 +53,7 @@ public class JPQLJoinSelectContext extends JPQLSelectContext implements
protected int relationShipAliasCounter = 0;
@Override
- public JPQLContext build() throws ODataJPAModelException,
- ODataJPARuntimeException {
+ public JPQLContext build() throws ODataJPAModelException, ODataJPARuntimeException {
try {
if (JPQLJoinSelectContext.this.isCountOnly) {
@@ -67,12 +65,9 @@ public class JPQLJoinSelectContext extends JPQLSelectContext implements
setJPAOuterJoinClause(generateJoinClauses());
if (!jpaJoinClauses.isEmpty()) {
- JPAJoinClause joinClause = jpaJoinClauses
- .get(jpaJoinClauses.size() - 1);
- setJPAEntityName(joinClause
- .getEntityName());
- setJPAEntityAlias(joinClause
- .getEntityRelationShipAlias());
+ JPAJoinClause joinClause = jpaJoinClauses.get(jpaJoinClauses.size() - 1);
+ setJPAEntityName(joinClause.getEntityName());
+ setJPAEntityAlias(joinClause.getEntityRelationShipAlias());
}
setOrderByCollection(generateOrderByFileds());
@@ -82,26 +77,21 @@ public class JPQLJoinSelectContext extends JPQLSelectContext implements
setWhereExpression(generateWhereExpression());
} catch (ODataException e) {
- throw ODataJPARuntimeException.throwException(
- ODataJPARuntimeException.INNER_EXCEPTION, e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
}
return JPQLJoinSelectContext.this;
}
- protected List<JPAJoinClause> generateJoinClauses()
- throws ODataJPARuntimeException, EdmException {
+ protected List<JPAJoinClause> generateJoinClauses() throws ODataJPARuntimeException, EdmException {
List<JPAJoinClause> jpaOuterJoinClauses = new ArrayList<JPAJoinClause>();
JPAJoinClause jpaOuterJoinClause = null;
String joinCondition = null;
String entityAlias = generateJPAEntityAlias();
- joinCondition = ODataExpressionParser.parseKeyPredicates(
- entitySetView.getKeyPredicates(),
- entityAlias);
+ joinCondition = ODataExpressionParser.parseKeyPredicates(entitySetView.getKeyPredicates(), entityAlias);
- EdmEntityType entityType = entitySetView.getStartEntitySet()
- .getEntityType();
+ EdmEntityType entityType = entitySetView.getStartEntitySet().getEntityType();
Mapping mapping = (Mapping) entityType.getMapping();
String entityTypeName = null;
if (mapping != null) {
@@ -110,33 +100,19 @@ public class JPQLJoinSelectContext extends JPQLSelectContext implements
entityTypeName = entityType.getName();
}
- jpaOuterJoinClause = new JPAJoinClause(
- entityTypeName,
- entityAlias,
- null,
- null, joinCondition,
- JPAJoinClause.JOIN.INNER);
+ jpaOuterJoinClause = new JPAJoinClause(entityTypeName, entityAlias, null, null, joinCondition, JPAJoinClause.JOIN.INNER);
jpaOuterJoinClauses.add(jpaOuterJoinClause);
- for (NavigationSegment navigationSegment : entitySetView
- .getNavigationSegments()) {
+ for (NavigationSegment navigationSegment : entitySetView.getNavigationSegments()) {
- EdmNavigationProperty navigationProperty = navigationSegment
- .getNavigationProperty();
+ EdmNavigationProperty navigationProperty = navigationSegment.getNavigationProperty();
String relationShipAlias = generateRelationShipAlias();
- joinCondition = ODataExpressionParser.parseKeyPredicates(
- navigationSegment.getKeyPredicates(),
- relationShipAlias);
+ joinCondition = ODataExpressionParser.parseKeyPredicates(navigationSegment.getKeyPredicates(), relationShipAlias);
- jpaOuterJoinClause = new JPAJoinClause(
- getFromEntityName(navigationProperty),
- entityAlias,
- getRelationShipName(navigationProperty),
- relationShipAlias, joinCondition,
- JPAJoinClause.JOIN.INNER);
+ jpaOuterJoinClause = new JPAJoinClause(getFromEntityName(navigationProperty), entityAlias, getRelationShipName(navigationProperty), relationShipAlias, joinCondition, JPAJoinClause.JOIN.INNER);
jpaOuterJoinClauses.add(jpaOuterJoinClause);
@@ -145,13 +121,11 @@ public class JPQLJoinSelectContext extends JPQLSelectContext implements
return jpaOuterJoinClauses;
}
- private String getFromEntityName(
- final EdmNavigationProperty navigationProperty) throws EdmException {
+ private String getFromEntityName(final EdmNavigationProperty navigationProperty) throws EdmException {
String fromRole = navigationProperty.getFromRole();
- EdmEntityType toEntityType = navigationProperty.getRelationship()
- .getEnd(fromRole).getEntityType();
+ EdmEntityType toEntityType = navigationProperty.getRelationship().getEnd(fromRole).getEntityType();
EdmMapping mapping = toEntityType.getMapping();
@@ -166,8 +140,7 @@ public class JPQLJoinSelectContext extends JPQLSelectContext implements
}
- private String getRelationShipName(
- final EdmNavigationProperty navigationProperty) throws EdmException {
+ private String getRelationShipName(final EdmNavigationProperty navigationProperty) throws EdmException {
EdmMapping mapping = navigationProperty.getMapping();
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinSelectSingleContext.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinSelectSingleContext.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinSelectSingleContext.java
index 3f504c1..bb385ca 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinSelectSingleContext.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinSelectSingleContext.java
@@ -35,8 +35,7 @@ import org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLContextType;
import org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLJoinSelectSingleContextView;
import org.apache.olingo.odata2.processor.core.jpa.ODataExpressionParser;
-public class JPQLJoinSelectSingleContext extends JPQLSelectSingleContext
- implements JPQLJoinSelectSingleContextView {
+public class JPQLJoinSelectSingleContext extends JPQLSelectSingleContext implements JPQLJoinSelectSingleContextView {
private List<JPAJoinClause> jpaJoinClauses = null;
@@ -44,51 +43,42 @@ public class JPQLJoinSelectSingleContext extends JPQLSelectSingleContext
this.jpaJoinClauses = jpaJoinClauses;
}
- public class JPQLJoinSelectSingleContextBuilder extends
- JPQLSelectSingleContextBuilder {
+ public class JPQLJoinSelectSingleContextBuilder extends JPQLSelectSingleContextBuilder {
protected int relationShipAliasCounter = 0;
@Override
- public JPQLContext build() throws ODataJPAModelException,
- ODataJPARuntimeException {
+ public JPQLContext build() throws ODataJPAModelException, ODataJPARuntimeException {
try {
setType(JPQLContextType.JOIN_SINGLE);
setJPAJoinClause(generateJoinClauses());
if (!jpaJoinClauses.isEmpty()) {
- JPAJoinClause joinClause = jpaJoinClauses
- .get(jpaJoinClauses.size() - 1);
+ JPAJoinClause joinClause = jpaJoinClauses.get(jpaJoinClauses.size() - 1);
setJPAEntityName(joinClause.getEntityName());
- setJPAEntityAlias(joinClause
- .getEntityRelationShipAlias());
+ setJPAEntityAlias(joinClause.getEntityRelationShipAlias());
}
- setKeyPredicates(entityView
- .getKeyPredicates());
+ setKeyPredicates(entityView.getKeyPredicates());
setSelectExpression(generateSelectExpression());
} catch (EdmException e) {
- throw ODataJPARuntimeException.throwException(
- ODataJPARuntimeException.GENERAL, e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL, e);
}
return JPQLJoinSelectSingleContext.this;
}
- protected List<JPAJoinClause> generateJoinClauses()
- throws ODataJPARuntimeException, EdmException {
+ protected List<JPAJoinClause> generateJoinClauses() throws ODataJPARuntimeException, EdmException {
List<JPAJoinClause> jpaOuterJoinClauses = new ArrayList<JPAJoinClause>();
JPAJoinClause jpaOuterJoinClause = null;
String joinCondition = null;
String entityAlias = generateJPAEntityAlias();
- joinCondition = ODataExpressionParser.parseKeyPredicates(
- entityView.getKeyPredicates(), entityAlias);
+ joinCondition = ODataExpressionParser.parseKeyPredicates(entityView.getKeyPredicates(), entityAlias);
- EdmEntityType entityType = entityView.getStartEntitySet()
- .getEntityType();
+ EdmEntityType entityType = entityView.getStartEntitySet().getEntityType();
Mapping mapping = (Mapping) entityType.getMapping();
String entityTypeName = null;
if (mapping != null) {
@@ -97,29 +87,19 @@ public class JPQLJoinSelectSingleContext extends JPQLSelectSingleContext
entityTypeName = entityType.getName();
}
- jpaOuterJoinClause = new JPAJoinClause(entityTypeName, entityAlias,
- null, null, joinCondition, JPAJoinClause.JOIN.INNER);
+ jpaOuterJoinClause = new JPAJoinClause(entityTypeName, entityAlias, null, null, joinCondition, JPAJoinClause.JOIN.INNER);
jpaOuterJoinClauses.add(jpaOuterJoinClause);
- for (NavigationSegment navigationSegment : entityView
- .getNavigationSegments()) {
+ for (NavigationSegment navigationSegment : entityView.getNavigationSegments()) {
- EdmNavigationProperty navigationProperty = navigationSegment
- .getNavigationProperty();
+ EdmNavigationProperty navigationProperty = navigationSegment.getNavigationProperty();
String relationShipAlias = generateRelationShipAlias();
- joinCondition = ODataExpressionParser
- .parseKeyPredicates(
- navigationSegment.getKeyPredicates(),
- relationShipAlias);
+ joinCondition = ODataExpressionParser.parseKeyPredicates(navigationSegment.getKeyPredicates(), relationShipAlias);
- jpaOuterJoinClause = new JPAJoinClause(
- getFromEntityName(navigationProperty), entityAlias,
- getRelationShipName(navigationProperty),
- relationShipAlias, joinCondition,
- JPAJoinClause.JOIN.INNER);
+ jpaOuterJoinClause = new JPAJoinClause(getFromEntityName(navigationProperty), entityAlias, getRelationShipName(navigationProperty), relationShipAlias, joinCondition, JPAJoinClause.JOIN.INNER);
jpaOuterJoinClauses.add(jpaOuterJoinClause);
@@ -128,13 +108,11 @@ public class JPQLJoinSelectSingleContext extends JPQLSelectSingleContext
return jpaOuterJoinClauses;
}
- private String getFromEntityName(
- final EdmNavigationProperty navigationProperty) throws EdmException {
+ private String getFromEntityName(final EdmNavigationProperty navigationProperty) throws EdmException {
String fromRole = navigationProperty.getFromRole();
- EdmEntityType fromEntityType = navigationProperty.getRelationship()
- .getEnd(fromRole).getEntityType();
+ EdmEntityType fromEntityType = navigationProperty.getRelationship().getEnd(fromRole).getEntityType();
EdmMapping mapping = fromEntityType.getMapping();
@@ -149,8 +127,7 @@ public class JPQLJoinSelectSingleContext extends JPQLSelectSingleContext
}
- private String getRelationShipName(
- final EdmNavigationProperty navigationProperty) throws EdmException {
+ private String getRelationShipName(final EdmNavigationProperty navigationProperty) throws EdmException {
EdmMapping mapping = navigationProperty.getMapping();
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinSelectSingleStatementBuilder.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinSelectSingleStatementBuilder.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinSelectSingleStatementBuilder.java
index 1e7d6f0..41282de 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinSelectSingleStatementBuilder.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinSelectSingleStatementBuilder.java
@@ -48,14 +48,11 @@ public class JPQLJoinSelectSingleStatementBuilder extends JPQLStatementBuilder {
StringBuilder jpqlQuery = new StringBuilder();
StringBuilder joinWhereCondition = null;
- jpqlQuery.append(JPQLStatement.KEYWORD.SELECT).append(
- JPQLStatement.DELIMITER.SPACE);
+ jpqlQuery.append(JPQLStatement.KEYWORD.SELECT).append(JPQLStatement.DELIMITER.SPACE);
jpqlQuery.append(context.getSelectExpression()).append(JPQLStatement.DELIMITER.SPACE);
- jpqlQuery.append(JPQLStatement.KEYWORD.FROM).append(
- JPQLStatement.DELIMITER.SPACE);
+ jpqlQuery.append(JPQLStatement.KEYWORD.FROM).append(JPQLStatement.DELIMITER.SPACE);
- if (context.getJPAJoinClauses() != null
- && context.getJPAJoinClauses().size() > 0) {
+ if (context.getJPAJoinClauses() != null && context.getJPAJoinClauses().size() > 0) {
List<JPAJoinClause> joinClauseList = context.getJPAJoinClauses();
JPAJoinClause joinClause = joinClauseList.get(0);
String joinCondition = joinClause.getJoinCondition();
@@ -65,8 +62,7 @@ public class JPQLJoinSelectSingleStatementBuilder extends JPQLStatementBuilder {
}
String relationShipAlias = null;
joinClause = joinClauseList.get(1);
- jpqlQuery.append(joinClause.getEntityName()).append(
- JPQLStatement.DELIMITER.SPACE);
+ jpqlQuery.append(joinClause.getEntityName()).append(JPQLStatement.DELIMITER.SPACE);
jpqlQuery.append(joinClause.getEntityAlias());
int i = 1;
@@ -74,14 +70,11 @@ public class JPQLJoinSelectSingleStatementBuilder extends JPQLStatementBuilder {
relationShipAlias = joinClause.getEntityAlias();
while (i < limit) {
jpqlQuery.append(JPQLStatement.DELIMITER.SPACE);
- jpqlQuery.append(JPQLStatement.KEYWORD.JOIN).append(
- JPQLStatement.DELIMITER.SPACE);
+ jpqlQuery.append(JPQLStatement.KEYWORD.JOIN).append(JPQLStatement.DELIMITER.SPACE);
joinClause = joinClauseList.get(i);
- jpqlQuery.append(relationShipAlias).append(
- JPQLStatement.DELIMITER.PERIOD);
- jpqlQuery.append(joinClause.getEntityRelationShip()).append(
- JPQLStatement.DELIMITER.SPACE);
+ jpqlQuery.append(relationShipAlias).append(JPQLStatement.DELIMITER.PERIOD);
+ jpqlQuery.append(joinClause.getEntityRelationShip()).append(JPQLStatement.DELIMITER.SPACE);
jpqlQuery.append(joinClause.getEntityRelationShipAlias());
relationShipAlias = joinClause.getEntityRelationShipAlias();
@@ -89,17 +82,14 @@ public class JPQLJoinSelectSingleStatementBuilder extends JPQLStatementBuilder {
joinCondition = joinClause.getJoinCondition();
if (joinCondition != null) {
- joinWhereCondition.append(JPQLStatement.DELIMITER.SPACE
- + JPQLStatement.Operator.AND
- + JPQLStatement.DELIMITER.SPACE);
+ joinWhereCondition.append(JPQLStatement.DELIMITER.SPACE + JPQLStatement.Operator.AND + JPQLStatement.DELIMITER.SPACE);
joinWhereCondition.append(joinCondition);
}
}
} else {
- throw ODataJPARuntimeException.throwException(
- ODataJPARuntimeException.JOIN_CLAUSE_EXPECTED, null);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.JOIN_CLAUSE_EXPECTED, null);
}
if (joinWhereCondition.length() > 0) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinStatementBuilder.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinStatementBuilder.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinStatementBuilder.java
index 336dd9b..afd09bf 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinStatementBuilder.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLJoinStatementBuilder.java
@@ -61,11 +61,9 @@ public class JPQLJoinStatementBuilder extends JPQLStatementBuilder {
jpqlQuery.append(context.getSelectExpression()).append(JPQLStatement.DELIMITER.SPACE);
}
- jpqlQuery.append(JPQLStatement.KEYWORD.FROM).append(
- JPQLStatement.DELIMITER.SPACE);
+ jpqlQuery.append(JPQLStatement.KEYWORD.FROM).append(JPQLStatement.DELIMITER.SPACE);
- if (context.getJPAJoinClauses() != null
- && context.getJPAJoinClauses().size() > 0) {
+ if (context.getJPAJoinClauses() != null && context.getJPAJoinClauses().size() > 0) {
List<JPAJoinClause> joinClauseList = context.getJPAJoinClauses();
JPAJoinClause joinClause = joinClauseList.get(0);
String joinCondition = joinClause.getJoinCondition();
@@ -75,8 +73,7 @@ public class JPQLJoinStatementBuilder extends JPQLStatementBuilder {
}
String relationShipAlias = null;
joinClause = joinClauseList.get(1);
- jpqlQuery.append(joinClause.getEntityName()).append(
- JPQLStatement.DELIMITER.SPACE);
+ jpqlQuery.append(joinClause.getEntityName()).append(JPQLStatement.DELIMITER.SPACE);
jpqlQuery.append(joinClause.getEntityAlias());
int i = 1;
@@ -84,14 +81,11 @@ public class JPQLJoinStatementBuilder extends JPQLStatementBuilder {
relationShipAlias = joinClause.getEntityAlias();
while (i < limit) {
jpqlQuery.append(JPQLStatement.DELIMITER.SPACE);
- jpqlQuery.append(JPQLStatement.KEYWORD.JOIN).append(
- JPQLStatement.DELIMITER.SPACE);
+ jpqlQuery.append(JPQLStatement.KEYWORD.JOIN).append(JPQLStatement.DELIMITER.SPACE);
joinClause = joinClauseList.get(i);
- jpqlQuery.append(relationShipAlias).append(
- JPQLStatement.DELIMITER.PERIOD);
- jpqlQuery.append(joinClause.getEntityRelationShip()).append(
- JPQLStatement.DELIMITER.SPACE);
+ jpqlQuery.append(relationShipAlias).append(JPQLStatement.DELIMITER.PERIOD);
+ jpqlQuery.append(joinClause.getEntityRelationShip()).append(JPQLStatement.DELIMITER.SPACE);
jpqlQuery.append(joinClause.getEntityRelationShipAlias());
relationShipAlias = joinClause.getEntityRelationShipAlias();
@@ -99,27 +93,21 @@ public class JPQLJoinStatementBuilder extends JPQLStatementBuilder {
joinCondition = joinClause.getJoinCondition();
if (joinCondition != null) {
- joinWhereCondition.append(JPQLStatement.DELIMITER.SPACE
- + JPQLStatement.Operator.AND
- + JPQLStatement.DELIMITER.SPACE);
+ joinWhereCondition.append(JPQLStatement.DELIMITER.SPACE + JPQLStatement.Operator.AND + JPQLStatement.DELIMITER.SPACE);
joinWhereCondition.append(joinCondition);
}
}
} else {
- throw ODataJPARuntimeException.throwException(
- ODataJPARuntimeException.JOIN_CLAUSE_EXPECTED, null);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.JOIN_CLAUSE_EXPECTED, null);
}
String whereExpression = context.getWhereExpression();
if (whereExpression != null || joinWhereCondition.length() > 0) {
- jpqlQuery.append(JPQLStatement.DELIMITER.SPACE).append(JPQLStatement.KEYWORD.WHERE).append(
- JPQLStatement.DELIMITER.SPACE);
+ jpqlQuery.append(JPQLStatement.DELIMITER.SPACE).append(JPQLStatement.KEYWORD.WHERE).append(JPQLStatement.DELIMITER.SPACE);
if (whereExpression != null) {
jpqlQuery.append(whereExpression);
if (joinWhereCondition != null) {
- jpqlQuery.append(JPQLStatement.DELIMITER.SPACE
- + JPQLStatement.Operator.AND
- + JPQLStatement.DELIMITER.SPACE);
+ jpqlQuery.append(JPQLStatement.DELIMITER.SPACE + JPQLStatement.Operator.AND + JPQLStatement.DELIMITER.SPACE);
}
}
if (joinWhereCondition != null) {
@@ -128,28 +116,23 @@ public class JPQLJoinStatementBuilder extends JPQLStatementBuilder {
}
- if (context.getOrderByCollection() != null
- && context.getOrderByCollection().size() > 0) {
+ if (context.getOrderByCollection() != null && context.getOrderByCollection().size() > 0) {
StringBuilder orderByBuilder = new StringBuilder();
- Iterator<Entry<String, String>> orderItr = context
- .getOrderByCollection().entrySet().iterator();
+ Iterator<Entry<String, String>> orderItr = context.getOrderByCollection().entrySet().iterator();
int i = 0;
while (orderItr.hasNext()) {
if (i != 0) {
- orderByBuilder.append(JPQLStatement.DELIMITER.SPACE).append(JPQLStatement.DELIMITER.COMMA)
- .append(JPQLStatement.DELIMITER.SPACE);
+ orderByBuilder.append(JPQLStatement.DELIMITER.SPACE).append(JPQLStatement.DELIMITER.COMMA).append(JPQLStatement.DELIMITER.SPACE);
}
Entry<String, String> entry = orderItr.next();
- orderByBuilder.append(entry.getKey())
- .append(JPQLStatement.DELIMITER.SPACE);
+ orderByBuilder.append(entry.getKey()).append(JPQLStatement.DELIMITER.SPACE);
orderByBuilder.append(entry.getValue());
i++;
}
- jpqlQuery.append(JPQLStatement.DELIMITER.SPACE).append(JPQLStatement.KEYWORD.ORDERBY).append(
- JPQLStatement.DELIMITER.SPACE);
+ jpqlQuery.append(JPQLStatement.DELIMITER.SPACE).append(JPQLStatement.KEYWORD.ORDERBY).append(JPQLStatement.DELIMITER.SPACE);
jpqlQuery.append(orderByBuilder);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectContext.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectContext.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectContext.java
index 61cd133..a04804f 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectContext.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectContext.java
@@ -32,8 +32,7 @@ import org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLContextType;
import org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLSelectContextView;
import org.apache.olingo.odata2.processor.core.jpa.ODataExpressionParser;
-public class JPQLSelectContext extends JPQLContext implements
- JPQLSelectContextView {
+public class JPQLSelectContext extends JPQLContext implements JPQLSelectContextView {
protected String selectExpression;
protected HashMap<String, String> orderByCollection;
@@ -45,8 +44,7 @@ public class JPQLSelectContext extends JPQLContext implements
this.isCountOnly = isCountOnly;
}
- protected final void setOrderByCollection(
- final HashMap<String, String> orderByCollection) {
+ protected final void setOrderByCollection(final HashMap<String, String> orderByCollection) {
this.orderByCollection = orderByCollection;
}
@@ -73,15 +71,12 @@ public class JPQLSelectContext extends JPQLContext implements
return whereCondition;
}
- public class JPQLSelectContextBuilder
- extends
- org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLContext.JPQLContextBuilder {
+ public class JPQLSelectContextBuilder extends org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLContext.JPQLContextBuilder {
protected GetEntitySetUriInfo entitySetView;
@Override
- public JPQLContext build() throws ODataJPAModelException,
- ODataJPARuntimeException {
+ public JPQLContext build() throws ODataJPAModelException, ODataJPARuntimeException {
if (entitySetView != null) {
try {
@@ -91,8 +86,7 @@ public class JPQLSelectContext extends JPQLContext implements
} else {
setType(JPQLContextType.SELECT);
}
- EdmEntityType entityType = entitySetView
- .getTargetEntitySet().getEntityType();
+ EdmEntityType entityType = entitySetView.getTargetEntitySet().getEntityType();
EdmMapping mapping = entityType.getMapping();
if (mapping != null) {
setJPAEntityName(mapping.getInternalName());
@@ -134,20 +128,15 @@ public class JPQLSelectContext extends JPQLContext implements
/*
* Generate Order By Clause Fields
*/
- protected HashMap<String, String> generateOrderByFileds()
- throws ODataJPARuntimeException, EdmException {
+ protected HashMap<String, String> generateOrderByFileds() throws ODataJPARuntimeException, EdmException {
if (entitySetView.getOrderBy() != null) {
- return ODataExpressionParser
- .parseToJPAOrderByExpression(entitySetView.getOrderBy(), getJPAEntityAlias());
+ return ODataExpressionParser.parseToJPAOrderByExpression(entitySetView.getOrderBy(), getJPAEntityAlias());
- } else if (entitySetView.getTop() != null
- || entitySetView.getSkip() != null) {
+ } else if (entitySetView.getTop() != null || entitySetView.getSkip() != null) {
- return ODataExpressionParser
- .parseKeyPropertiesToJPAOrderByExpression(entitySetView.getTargetEntitySet()
- .getEntityType().getKeyProperties(), getJPAEntityAlias());
+ return ODataExpressionParser.parseKeyPropertiesToJPAOrderByExpression(entitySetView.getTargetEntitySet().getEntityType().getKeyProperties(), getJPAEntityAlias());
} else {
return null;
}
@@ -159,8 +148,7 @@ public class JPQLSelectContext extends JPQLContext implements
*/
protected String generateWhereExpression() throws ODataException {
if (entitySetView.getFilter() != null) {
- return ODataExpressionParser
- .parseToJPAWhereExpression(entitySetView.getFilter(), getJPAEntityAlias());
+ return ODataExpressionParser.parseToJPAWhereExpression(entitySetView.getFilter(), getJPAEntityAlias());
}
return null;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectSingleContext.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectSingleContext.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectSingleContext.java
index f2ddcef..b8e8323 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectSingleContext.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectSingleContext.java
@@ -54,9 +54,7 @@ public class JPQLSelectSingleContext extends JPQLContext implements JPQLSelectSi
return selectExpression;
}
- public class JPQLSelectSingleContextBuilder
- extends
- org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLContext.JPQLContextBuilder {
+ public class JPQLSelectSingleContextBuilder extends org.apache.olingo.odata2.processor.api.jpa.jpql.JPQLContext.JPQLContextBuilder {
protected GetEntityUriInfo entityView;
@@ -68,8 +66,7 @@ public class JPQLSelectSingleContext extends JPQLContext implements JPQLSelectSi
setType(JPQLContextType.SELECT_SINGLE);
- EdmEntityType entityType = entityView
- .getTargetEntitySet().getEntityType();
+ EdmEntityType entityType = entityView.getTargetEntitySet().getEntityType();
EdmMapping mapping = entityType.getMapping();
if (mapping != null) {
setJPAEntityName(mapping.getInternalName());
@@ -84,9 +81,7 @@ public class JPQLSelectSingleContext extends JPQLContext implements JPQLSelectSi
setSelectExpression(generateSelectExpression());
} catch (EdmException e) {
- throw ODataJPARuntimeException.throwException(
- ODataJPARuntimeException.GENERAL.addContent(e
- .getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectSingleStatementBuilder.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectSingleStatementBuilder.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectSingleStatementBuilder.java
index 7ffa49f..651024b 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectSingleStatementBuilder.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectSingleStatementBuilder.java
@@ -45,21 +45,17 @@ public class JPQLSelectSingleStatementBuilder extends JPQLStatementBuilder {
StringBuilder jpqlQuery = new StringBuilder();
String tableAlias = context.getJPAEntityAlias();
- String fromClause = context.getJPAEntityName()
- + JPQLStatement.DELIMITER.SPACE + tableAlias;
+ String fromClause = context.getJPAEntityName() + JPQLStatement.DELIMITER.SPACE + tableAlias;
- jpqlQuery.append(JPQLStatement.KEYWORD.SELECT).append(
- JPQLStatement.DELIMITER.SPACE);
+ jpqlQuery.append(JPQLStatement.KEYWORD.SELECT).append(JPQLStatement.DELIMITER.SPACE);
jpqlQuery.append(context.getSelectExpression()).append(JPQLStatement.DELIMITER.SPACE);
jpqlQuery.append(JPQLStatement.KEYWORD.FROM).append(JPQLStatement.DELIMITER.SPACE);
jpqlQuery.append(fromClause);
- if (context.getKeyPredicates() != null
- && context.getKeyPredicates().size() > 0) {
+ if (context.getKeyPredicates() != null && context.getKeyPredicates().size() > 0) {
jpqlQuery.append(JPQLStatement.DELIMITER.SPACE);
jpqlQuery.append(JPQLStatement.KEYWORD.WHERE).append(JPQLStatement.DELIMITER.SPACE);
- jpqlQuery.append(ODataExpressionParser.parseKeyPredicates(context.getKeyPredicates(),
- context.getJPAEntityAlias()));
+ jpqlQuery.append(ODataExpressionParser.parseKeyPredicates(context.getKeyPredicates(), context.getJPAEntityAlias()));
}
return jpqlQuery.toString();
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectStatementBuilder.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectStatementBuilder.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectStatementBuilder.java
index 8fc2792..34d4a58 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectStatementBuilder.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/jpql/JPQLSelectStatementBuilder.java
@@ -69,12 +69,10 @@ public class JPQLSelectStatementBuilder extends JPQLStatementBuilder {
jpqlQuery.append(context.getWhereExpression());
}
- if (context.getOrderByCollection() != null
- && context.getOrderByCollection().size() > 0) {
+ if (context.getOrderByCollection() != null && context.getOrderByCollection().size() > 0) {
StringBuilder orderByBuilder = new StringBuilder();
- Iterator<Entry<String, String>> orderItr = context
- .getOrderByCollection().entrySet().iterator();
+ Iterator<Entry<String, String>> orderItr = context.getOrderByCollection().entrySet().iterator();
int i = 0;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmAssociation.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmAssociation.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmAssociation.java
index 0f6e1ec..9f0a9e7 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmAssociation.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmAssociation.java
@@ -36,8 +36,7 @@ import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmReferentialConstra
import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmSchemaView;
import org.apache.olingo.odata2.processor.core.jpa.access.model.JPAEdmNameBuilder;
-public class JPAEdmAssociation extends JPAEdmBaseViewImpl implements
- JPAEdmAssociationView {
+public class JPAEdmAssociation extends JPAEdmBaseViewImpl implements JPAEdmAssociationView {
private JPAEdmAssociationEndView associationEndView;
@@ -48,9 +47,7 @@ public class JPAEdmAssociation extends JPAEdmBaseViewImpl implements
private List<JPAEdmReferentialConstraintView> inconsistentRefConstraintViewList;
private int numberOfSimilarEndPoints;
- public JPAEdmAssociation(final JPAEdmAssociationEndView associationEndview,
- final JPAEdmEntityTypeView entityTypeView,
- final JPAEdmPropertyView propertyView, final int value) {
+ public JPAEdmAssociation(final JPAEdmAssociationEndView associationEndview, final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView, final int value) {
super(associationEndview);
associationEndView = associationEndview;
numberOfSimilarEndPoints = value;
@@ -94,35 +91,23 @@ public class JPAEdmAssociation extends JPAEdmBaseViewImpl implements
for (String key : associationMap.keySet()) {
Association association = associationMap.get(key);
if (association != null) {
- if (view.compare(association.getEnd1(),
- association.getEnd2())) {
- JPAEdmAssociationEndView associationEnd = associationEndMap
- .get(association.getName());
- if (associationEnd.getJoinColumnName() != null
- && associationEnd
- .getJoinColumnReferenceColumnName() != null
- && view.getJoinColumnName() != null
- && view.getJoinColumnReferenceColumnName() != null) {
- if (view.getJoinColumnName().equals(
- associationEnd.getJoinColumnName())
- && view.getJoinColumnReferenceColumnName()
- .equals(associationEnd
- .getJoinColumnReferenceColumnName())) {
+ if (view.compare(association.getEnd1(), association.getEnd2())) {
+ JPAEdmAssociationEndView associationEnd = associationEndMap.get(association.getName());
+ if (associationEnd.getJoinColumnName() != null && associationEnd.getJoinColumnReferenceColumnName() != null && view.getJoinColumnName() != null && view.getJoinColumnReferenceColumnName() != null) {
+ if (view.getJoinColumnName().equals(associationEnd.getJoinColumnName()) && view.getJoinColumnReferenceColumnName().equals(associationEnd.getJoinColumnReferenceColumnName())) {
currentAssociation = association;
return association;
}
}
if (associationEnd.getMappedByName() != null) {
- if (associationEnd.getMappedByName().equals(
- view.getOwningPropertyName())) {
+ if (associationEnd.getMappedByName().equals(view.getOwningPropertyName())) {
currentAssociation = association;
return association;
}
}
if (associationEnd.getOwningPropertyName() != null) {
- if (associationEnd.getOwningPropertyName().equals(
- view.getMappedByName())) {
+ if (associationEnd.getOwningPropertyName().equals(view.getMappedByName())) {
currentAssociation = association;
return association;
}
@@ -135,22 +120,17 @@ public class JPAEdmAssociation extends JPAEdmBaseViewImpl implements
}
@Override
- public void addJPAEdmAssociationView(final JPAEdmAssociationView associationView,
- final JPAEdmAssociationEndView associationEndView) {
+ public void addJPAEdmAssociationView(final JPAEdmAssociationView associationView, final JPAEdmAssociationEndView associationEndView) {
if (associationView != null) {
currentAssociation = associationView.getEdmAssociation();
- associationMap
- .put(currentAssociation.getName(), currentAssociation);
- associationEndMap.put(currentAssociation.getName(),
- associationEndView);
- addJPAEdmRefConstraintView(associationView
- .getJPAEdmReferentialConstraintView());
+ associationMap.put(currentAssociation.getName(), currentAssociation);
+ associationEndMap.put(currentAssociation.getName(), associationEndView);
+ addJPAEdmRefConstraintView(associationView.getJPAEdmReferentialConstraintView());
}
}
@Override
- public void addJPAEdmRefConstraintView(
- final JPAEdmReferentialConstraintView refView) {
+ public void addJPAEdmRefConstraintView(final JPAEdmReferentialConstraintView refView) {
if (refView != null && refView.isExists()) {
inconsistentRefConstraintViewList.add(refView);
}
@@ -167,43 +147,32 @@ public class JPAEdmAssociation extends JPAEdmBaseViewImpl implements
private class JPAEdmAssociationBuilder implements JPAEdmBuilder {
@Override
- public void build() throws ODataJPAModelException,
- ODataJPARuntimeException {
+ public void build() throws ODataJPAModelException, ODataJPARuntimeException {
- if (associationEndView != null
- && searchAssociation(associationEndView) == null) {
+ if (associationEndView != null && searchAssociation(associationEndView) == null) {
currentAssociation = new Association();
- currentAssociation.setEnd1(associationEndView
- .getEdmAssociationEnd1());
- currentAssociation.setEnd2(associationEndView
- .getEdmAssociationEnd2());
+ currentAssociation.setEnd1(associationEndView.getEdmAssociationEnd1());
+ currentAssociation.setEnd2(associationEndView.getEdmAssociationEnd2());
- JPAEdmNameBuilder.build(JPAEdmAssociation.this,
- numberOfSimilarEndPoints);
+ JPAEdmNameBuilder.build(JPAEdmAssociation.this, numberOfSimilarEndPoints);
- associationMap.put(currentAssociation.getName(),
- currentAssociation);
+ associationMap.put(currentAssociation.getName(), currentAssociation);
} else if (!inconsistentRefConstraintViewList.isEmpty()) {
- int inconsistentRefConstraintViewSize = inconsistentRefConstraintViewList
- .size();
+ int inconsistentRefConstraintViewSize = inconsistentRefConstraintViewList.size();
int index = 0;
for (int i = 0; i < inconsistentRefConstraintViewSize; i++) {
- JPAEdmReferentialConstraintView view = inconsistentRefConstraintViewList
- .get(index);
+ JPAEdmReferentialConstraintView view = inconsistentRefConstraintViewList.get(index);
if (view.isExists() && !view.isConsistent()) {
view.getBuilder().build();
}
if (view.isConsistent()) {
Association newAssociation = new Association();
- copyAssociation(newAssociation, associationMap.get(view
- .getEdmRelationShipName()));
- newAssociation.setReferentialConstraint(view
- .getEdmReferentialConstraint());
+ copyAssociation(newAssociation, associationMap.get(view.getEdmRelationShipName()));
+ newAssociation.setReferentialConstraint(view.getEdmReferentialConstraint());
consistentAssociatonList.add(newAssociation);
- associationMap.put(view.getEdmRelationShipName(),
- newAssociation);
+ associationMap.put(view.getEdmRelationShipName(), newAssociation);
inconsistentRefConstraintViewList.remove(index);
} else {
associationMap.remove(view.getEdmRelationShipName());
@@ -226,24 +195,19 @@ public class JPAEdmAssociation extends JPAEdmBaseViewImpl implements
}
- private void copyAssociation(final Association copyToAssociation,
- final Association copyFromAssociation) {
+ private void copyAssociation(final Association copyToAssociation, final Association copyFromAssociation) {
copyToAssociation.setEnd1(copyFromAssociation.getEnd1());
copyToAssociation.setEnd2(copyFromAssociation.getEnd2());
copyToAssociation.setName(copyFromAssociation.getName());
- copyToAssociation.setAnnotationAttributes(copyFromAssociation
- .getAnnotationAttributes());
- copyToAssociation.setAnnotationElements(copyFromAssociation
- .getAnnotationElements());
- copyToAssociation.setDocumentation(copyFromAssociation
- .getDocumentation());
+ copyToAssociation.setAnnotationAttributes(copyFromAssociation.getAnnotationAttributes());
+ copyToAssociation.setAnnotationElements(copyFromAssociation.getAnnotationElements());
+ copyToAssociation.setDocumentation(copyFromAssociation.getDocumentation());
}
}
@Override
- public int getNumberOfAssociationsWithSimilarEndPoints(
- final JPAEdmAssociationEndView view) {
+ public int getNumberOfAssociationsWithSimilarEndPoints(final JPAEdmAssociationEndView view) {
int count = 0;
AssociationEnd currentAssociationEnd1 = view.getEdmAssociationEnd1();
AssociationEnd currentAssociationEnd2 = view.getEdmAssociationEnd2();
@@ -254,12 +218,7 @@ public class JPAEdmAssociation extends JPAEdmBaseViewImpl implements
if (association != null) {
end1 = association.getEnd1();
end2 = association.getEnd2();
- if ((end1.getType().equals(currentAssociationEnd1.getType()) && end2
- .getType().equals(currentAssociationEnd2.getType()))
- || (end1.getType().equals(
- currentAssociationEnd2.getType()) && end2
- .getType().equals(
- currentAssociationEnd1.getType()))) {
+ if ((end1.getType().equals(currentAssociationEnd1.getType()) && end2.getType().equals(currentAssociationEnd2.getType())) || (end1.getType().equals(currentAssociationEnd2.getType()) && end2.getType().equals(currentAssociationEnd1.getType()))) {
count++;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmAssociationEnd.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmAssociationEnd.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmAssociationEnd.java
index 91176ad..23e8e49 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmAssociationEnd.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmAssociationEnd.java
@@ -35,8 +35,7 @@ import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmEntityTypeView;
import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmPropertyView;
import org.apache.olingo.odata2.processor.core.jpa.access.model.JPAEdmNameBuilder;
-public class JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
- JPAEdmAssociationEndView {
+public class JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements JPAEdmAssociationEndView {
private JPAEdmEntityTypeView entityTypeView = null;
private JPAEdmPropertyView propertyView = null;
@@ -47,8 +46,7 @@ public class JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
private String mappedBy;
private String ownerPropertyName;
- public JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView,
- final JPAEdmPropertyView propertyView) {
+ public JPAEdmAssociationEnd(final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView) {
super(entityTypeView);
this.entityTypeView = entityTypeView;
this.propertyView = propertyView;
@@ -83,19 +81,14 @@ public class JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
currentAssociationEnd1 = new AssociationEnd();
currentAssociationEnd2 = new AssociationEnd();
- JPAEdmNameBuilder.build(JPAEdmAssociationEnd.this, entityTypeView,
- propertyView);
+ JPAEdmNameBuilder.build(JPAEdmAssociationEnd.this, entityTypeView, propertyView);
- currentAssociationEnd1.setRole(currentAssociationEnd1.getType()
- .getName());
- currentAssociationEnd2.setRole(currentAssociationEnd2.getType()
- .getName());
+ currentAssociationEnd1.setRole(currentAssociationEnd1.getType().getName());
+ currentAssociationEnd2.setRole(currentAssociationEnd2.getType().getName());
- setEdmMultiplicity(propertyView.getJPAAttribute()
- .getPersistentAttributeType());
+ setEdmMultiplicity(propertyView.getJPAAttribute().getPersistentAttributeType());
- AnnotatedElement annotatedElement = (AnnotatedElement) propertyView.getJPAAttribute()
- .getJavaMember();
+ AnnotatedElement annotatedElement = (AnnotatedElement) propertyView.getJPAAttribute().getJavaMember();
if (annotatedElement != null) {
joinColumn = annotatedElement.getAnnotation(JoinColumn.class);
if (joinColumn != null) {
@@ -109,8 +102,7 @@ public class JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
}
private void setEdmMultiplicity(final PersistentAttributeType type) {
- AnnotatedElement annotatedElement = (AnnotatedElement) propertyView.getJPAAttribute()
- .getJavaMember();
+ AnnotatedElement annotatedElement = (AnnotatedElement) propertyView.getJPAAttribute().getJavaMember();
switch (type) {
case ONE_TO_MANY:
currentAssociationEnd1.setMultiplicity(EdmMultiplicity.ONE);
@@ -154,19 +146,7 @@ public class JPAEdmAssociationEnd extends JPAEdmBaseViewImpl implements
@Override
public boolean compare(final AssociationEnd end1, final AssociationEnd end2) {
- if ((end1.getType().equals(currentAssociationEnd1.getType())
- && end2.getType().equals(currentAssociationEnd2.getType())
- && end1.getMultiplicity().equals(
- currentAssociationEnd1.getMultiplicity()) && end2
- .getMultiplicity().equals(
- currentAssociationEnd2.getMultiplicity()))
- || (end1.getType().equals(currentAssociationEnd2.getType())
- && end2.getType().equals(
- currentAssociationEnd1.getType())
- && end1.getMultiplicity().equals(
- currentAssociationEnd2.getMultiplicity()) && end2
- .getMultiplicity().equals(
- currentAssociationEnd1.getMultiplicity()))) {
+ if ((end1.getType().equals(currentAssociationEnd1.getType()) && end2.getType().equals(currentAssociationEnd2.getType()) && end1.getMultiplicity().equals(currentAssociationEnd1.getMultiplicity()) && end2.getMultiplicity().equals(currentAssociationEnd2.getMultiplicity())) || (end1.getType().equals(currentAssociationEnd2.getType()) && end2.getType().equals(currentAssociationEnd1.getType()) && end1.getMultiplicity().equals(currentAssociationEnd2.getMultiplicity()) && end2.getMultiplicity().equals(currentAssociationEnd1.getMultiplicity()))) {
return true;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmAssociationSet.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmAssociationSet.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmAssociationSet.java
index d6ce8ac..52ebe72 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmAssociationSet.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmAssociationSet.java
@@ -34,8 +34,7 @@ import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmEntitySetView;
import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmSchemaView;
import org.apache.olingo.odata2.processor.core.jpa.access.model.JPAEdmNameBuilder;
-public class JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
- JPAEdmAssociationSetView {
+public class JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements JPAEdmAssociationSetView {
private JPAEdmSchemaView schemaView;
private AssociationSet currentAssociationSet;
@@ -80,22 +79,16 @@ public class JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
associationSetList = new ArrayList<AssociationSet>();
}
- JPAEdmAssociationView associationView = schemaView
- .getJPAEdmAssociationView();
- JPAEdmEntitySetView entitySetView = schemaView
- .getJPAEdmEntityContainerView().getJPAEdmEntitySetView();
+ JPAEdmAssociationView associationView = schemaView.getJPAEdmAssociationView();
+ JPAEdmEntitySetView entitySetView = schemaView.getJPAEdmEntityContainerView().getJPAEdmEntitySetView();
- List<EntitySet> entitySetList = entitySetView
- .getConsistentEdmEntitySetList();
+ List<EntitySet> entitySetList = entitySetView.getConsistentEdmEntitySetList();
if (associationView.isConsistent()) {
- for (Association association : associationView
- .getConsistentEdmAssociationList()) {
+ for (Association association : associationView.getConsistentEdmAssociationList()) {
currentAssociation = association;
- FullQualifiedName fQname = new FullQualifiedName(schemaView
- .getEdmSchema().getNamespace(),
- association.getName());
+ FullQualifiedName fQname = new FullQualifiedName(schemaView.getEdmSchema().getNamespace(), association.getName());
currentAssociationSet = new AssociationSet();
currentAssociationSet.setAssociation(fQname);
@@ -104,10 +97,7 @@ public class JPAEdmAssociationSet extends JPAEdmBaseViewImpl implements
for (EntitySet entitySet : entitySetList) {
fQname = entitySet.getEntityType();
endFlag = 0;
- if (fQname.equals(association.getEnd1().getType())
- || ++endFlag > 1
- || fQname.equals(association.getEnd2()
- .getType())) {
+ if (fQname.equals(association.getEnd1().getType()) || ++endFlag > 1 || fQname.equals(association.getEnd2().getType())) {
AssociationSetEnd end = new AssociationSetEnd();
end.setEntitySet(entitySet.getName());
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmBaseViewImpl.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmBaseViewImpl.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmBaseViewImpl.java
index 4070032..1524402 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmBaseViewImpl.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmBaseViewImpl.java
@@ -46,8 +46,7 @@ public abstract class JPAEdmBaseViewImpl implements JPAEdmBaseView {
public JPAEdmBaseViewImpl(final ODataJPAContext context) {
pUnitName = context.getPersistenceUnitName();
metaModel = context.getEntityManagerFactory().getMetamodel();
- jpaEdmMappingModelAccess = ODataJPAFactory.createFactory()
- .getJPAAccessFactory().getJPAEdmMappingModelAccess(context);
+ jpaEdmMappingModelAccess = ODataJPAFactory.createFactory().getJPAAccessFactory().getJPAEdmMappingModelAccess(context);
jpaEdmExtension = context.getJPAEdmExtension();
jpaEdmMappingModelAccess.loadMappingModel();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmComplexType.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmComplexType.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmComplexType.java
index a68dbc6..42cc937 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmComplexType.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmComplexType.java
@@ -43,8 +43,7 @@ import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmPropertyView;
import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmSchemaView;
import org.apache.olingo.odata2.processor.core.jpa.access.model.JPAEdmNameBuilder;
-public class JPAEdmComplexType extends JPAEdmBaseViewImpl implements
- JPAEdmComplexTypeView {
+public class JPAEdmComplexType extends JPAEdmBaseViewImpl implements JPAEdmComplexTypeView {
private JPAEdmSchemaView schemaView;
private ComplexType currentComplexType = null;
@@ -63,10 +62,8 @@ public class JPAEdmComplexType extends JPAEdmBaseViewImpl implements
public JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute) {
super(view);
schemaView = view;
- for (EmbeddableType<?> jpaEmbeddable : schemaView.getJPAMetaModel().getEmbeddables())
- {
- if (jpaEmbeddable.getJavaType().getName().equals(complexAttribute.getJavaType().getName()))
- {
+ for (EmbeddableType<?> jpaEmbeddable : schemaView.getJPAMetaModel().getEmbeddables()) {
+ if (jpaEmbeddable.getJavaType().getName().equals(complexAttribute.getJavaType().getName())) {
nestedComplexType = jpaEmbeddable;
break;
}
@@ -136,8 +133,7 @@ public class JPAEdmComplexType extends JPAEdmBaseViewImpl implements
if (expandedList == null) {
expandedList = new ArrayList<Property>();
}
- for (Property property : complexType.getProperties())
- {
+ for (Property property : complexType.getProperties()) {
try {
SimpleProperty newSimpleProperty = new SimpleProperty();
SimpleProperty oldSimpleProperty = (SimpleProperty) property;
@@ -227,13 +223,11 @@ public class JPAEdmComplexType extends JPAEdmBaseViewImpl implements
continue;
}
- JPAEdmPropertyView propertyView = new JPAEdmProperty(
- schemaView, JPAEdmComplexType.this);
+ JPAEdmPropertyView propertyView = new JPAEdmProperty(schemaView, JPAEdmComplexType.this);
propertyView.getBuilder().build();
currentComplexType = new ComplexType();
- currentComplexType
- .setProperties(propertyView.getEdmPropertyList());
+ currentComplexType.setProperties(propertyView.getEdmPropertyList());
JPAEdmNameBuilder.build(JPAEdmComplexType.this);
searchMap.put(searchKey, currentComplexType);
@@ -245,12 +239,8 @@ public class JPAEdmComplexType extends JPAEdmBaseViewImpl implements
private boolean isExcluded(final JPAEdmComplexType jpaEdmComplexType) {
- JPAEdmMappingModelAccess mappingModelAccess = jpaEdmComplexType
- .getJPAEdmMappingModelAccess();
- if (mappingModelAccess != null
- && mappingModelAccess.isMappingModelExists()
- && mappingModelAccess.checkExclusionOfJPAEmbeddableType(jpaEdmComplexType.getJPAEmbeddableType()
- .getJavaType().getSimpleName())) {
+ JPAEdmMappingModelAccess mappingModelAccess = jpaEdmComplexType.getJPAEdmMappingModelAccess();
+ if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists() && mappingModelAccess.checkExclusionOfJPAEmbeddableType(jpaEdmComplexType.getJPAEmbeddableType().getJavaType().getSimpleName())) {
return true;
}
return false;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmEntityContainer.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmEntityContainer.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmEntityContainer.java
index 587c2ef..8af8f6b 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmEntityContainer.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmEntityContainer.java
@@ -32,8 +32,7 @@ import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmFunctionImportView
import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmSchemaView;
import org.apache.olingo.odata2.processor.core.jpa.access.model.JPAEdmNameBuilder;
-public class JPAEdmEntityContainer extends JPAEdmBaseViewImpl implements
- JPAEdmEntityContainerView {
+public class JPAEdmEntityContainer extends JPAEdmBaseViewImpl implements JPAEdmEntityContainerView {
private JPAEdmEntitySetView entitySetView;
private JPAEdmSchemaView schemaView;
@@ -106,8 +105,7 @@ public class JPAEdmEntityContainer extends JPAEdmBaseViewImpl implements
* ************************************************************
*/
@Override
- public void build() throws ODataJPAModelException,
- ODataJPARuntimeException {
+ public void build() throws ODataJPAModelException, ODataJPARuntimeException {
currentEntityContainer = new EntityContainer();
@@ -119,8 +117,7 @@ public class JPAEdmEntityContainer extends JPAEdmBaseViewImpl implements
entitySetView = new JPAEdmEntitySet(schemaView);
entitySetView.getBuilder().build();
if (entitySetView.isConsistent()) {
- currentEntityContainer.setEntitySets(entitySetView
- .getConsistentEdmEntitySetList());
+ currentEntityContainer.setEntitySets(entitySetView.getConsistentEdmEntitySetList());
} else {
isConsistent = false;
return;
@@ -133,8 +130,7 @@ public class JPAEdmEntityContainer extends JPAEdmBaseViewImpl implements
associationSetView = new JPAEdmAssociationSet(schemaView);
associationSetView.getBuilder().build();
if (associationSetView.isConsistent()) {
- currentEntityContainer.setAssociationSets(associationSetView
- .getConsistentEdmAssociationSetList());
+ currentEntityContainer.setAssociationSets(associationSetView.getConsistentEdmAssociationSetList());
} else {
isConsistent = false;
return;
@@ -142,13 +138,10 @@ public class JPAEdmEntityContainer extends JPAEdmBaseViewImpl implements
JPAEdmNameBuilder.build(JPAEdmEntityContainer.this);
if (schemaView.getJPAEdmExtension() != null) {
- JPAEdmFunctionImportView functionImportView = new JPAEdmFunctionImport(
- schemaView);
+ JPAEdmFunctionImportView functionImportView = new JPAEdmFunctionImport(schemaView);
functionImportView.getBuilder().build();
if (functionImportView.getConsistentFunctionImportList() != null) {
- currentEntityContainer
- .setFunctionImports(functionImportView
- .getConsistentFunctionImportList());
+ currentEntityContainer.setFunctionImports(functionImportView.getConsistentFunctionImportList());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmEntitySet.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmEntitySet.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmEntitySet.java
index d79ac2d..4f52d7d 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmEntitySet.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmEntitySet.java
@@ -32,8 +32,7 @@ import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmEntityTypeView;
import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmSchemaView;
import org.apache.olingo.odata2.processor.core.jpa.access.model.JPAEdmNameBuilder;
-public class JPAEdmEntitySet extends JPAEdmBaseViewImpl implements
- JPAEdmEntitySetView {
+public class JPAEdmEntitySet extends JPAEdmBaseViewImpl implements JPAEdmEntitySetView {
private EntitySet currentEntitySet = null;
private List<EntitySet> consistentEntitySetList = null;
@@ -92,12 +91,10 @@ public class JPAEdmEntitySet extends JPAEdmBaseViewImpl implements
if (entityTypeView.isConsistent() && entityTypeView.getConsistentEdmEntityTypes() != null) {
String nameSpace = schemaView.getEdmSchema().getNamespace();
- for (EntityType entityType : entityTypeView
- .getConsistentEdmEntityTypes()) {
+ for (EntityType entityType : entityTypeView.getConsistentEdmEntityTypes()) {
currentEntitySet = new EntitySet();
- currentEntitySet.setEntityType(new FullQualifiedName(
- nameSpace, entityType.getName()));
+ currentEntitySet.setEntityType(new FullQualifiedName(nameSpace, entityType.getName()));
JPAEdmNameBuilder.build(JPAEdmEntitySet.this, entityTypeView);
consistentEntitySetList.add(currentEntitySet);
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmEntityType.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmEntityType.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmEntityType.java
index 7bb5a5c..9c158a9 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmEntityType.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmEntityType.java
@@ -37,8 +37,7 @@ import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmPropertyView;
import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmSchemaView;
import org.apache.olingo.odata2.processor.core.jpa.access.model.JPAEdmNameBuilder;
-public class JPAEdmEntityType extends JPAEdmBaseViewImpl implements
- JPAEdmEntityTypeView {
+public class JPAEdmEntityType extends JPAEdmBaseViewImpl implements JPAEdmEntityTypeView {
private JPAEdmSchemaView schemaView = null;
private EntityType currentEdmEntityType = null;
@@ -85,11 +84,9 @@ public class JPAEdmEntityType extends JPAEdmBaseViewImpl implements
private class JPAEdmEntityTypeBuilder implements JPAEdmBuilder {
@Override
- public void build() throws ODataJPAModelException,
- ODataJPARuntimeException {
+ public void build() throws ODataJPAModelException, ODataJPARuntimeException {
- Set<javax.persistence.metamodel.EntityType<?>> jpaEntityTypes = metaModel
- .getEntities();
+ Set<javax.persistence.metamodel.EntityType<?>> jpaEntityTypes = metaModel.getEntities();
if (jpaEntityTypes == null || jpaEntityTypes.isEmpty() == true) {
return;
@@ -112,36 +109,25 @@ public class JPAEdmEntityType extends JPAEdmBaseViewImpl implements
JPAEdmPropertyView propertyView = new JPAEdmProperty(schemaView);
propertyView.getBuilder().build();
- currentEdmEntityType.setProperties(propertyView
- .getEdmPropertyList());
+ currentEdmEntityType.setProperties(propertyView.getEdmPropertyList());
if (propertyView.getJPAEdmNavigationPropertyView() != null) {
- JPAEdmNavigationPropertyView navPropView = propertyView
- .getJPAEdmNavigationPropertyView();
- if (navPropView.getConsistentEdmNavigationProperties() != null
- && !navPropView
- .getConsistentEdmNavigationProperties()
- .isEmpty()) {
- currentEdmEntityType
- .setNavigationProperties(navPropView
- .getConsistentEdmNavigationProperties());
+ JPAEdmNavigationPropertyView navPropView = propertyView.getJPAEdmNavigationPropertyView();
+ if (navPropView.getConsistentEdmNavigationProperties() != null && !navPropView.getConsistentEdmNavigationProperties().isEmpty()) {
+ currentEdmEntityType.setNavigationProperties(navPropView.getConsistentEdmNavigationProperties());
}
}
JPAEdmKeyView keyView = propertyView.getJPAEdmKeyView();
currentEdmEntityType.setKey(keyView.getEdmKey());
consistentEntityTypes.add(currentEdmEntityType);
- consistentEntityTypeMap.put(currentJPAEntityType.getName(),
- currentEdmEntityType);
+ consistentEntityTypeMap.put(currentJPAEntityType.getName(), currentEdmEntityType);
}
}
private boolean isExcluded(final JPAEdmEntityType jpaEdmEntityType) {
- JPAEdmMappingModelAccess mappingModelAccess = jpaEdmEntityType
- .getJPAEdmMappingModelAccess();
- if (mappingModelAccess != null
- && mappingModelAccess.isMappingModelExists()
- && mappingModelAccess.checkExclusionOfJPAEntityType(jpaEdmEntityType.getJPAEntityType().getName())) {
+ JPAEdmMappingModelAccess mappingModelAccess = jpaEdmEntityType.getJPAEdmMappingModelAccess();
+ if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists() && mappingModelAccess.checkExclusionOfJPAEntityType(jpaEdmEntityType.getJPAEntityType().getName())) {
return true;
}
return false;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmFunctionImport.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmFunctionImport.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmFunctionImport.java
index ad12196..ab89ce9 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmFunctionImport.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmFunctionImport.java
@@ -48,8 +48,7 @@ import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmSchemaView;
import org.apache.olingo.odata2.processor.core.jpa.access.model.JPAEdmNameBuilder;
import org.apache.olingo.odata2.processor.core.jpa.access.model.JPATypeConvertor;
-public class JPAEdmFunctionImport extends JPAEdmBaseViewImpl implements
- JPAEdmFunctionImportView {
+public class JPAEdmFunctionImport extends JPAEdmBaseViewImpl implements JPAEdmFunctionImportView {
private List<FunctionImport> consistentFunctionImportList = new ArrayList<FunctionImport>();
private JPAEdmBuilder builder = null;
@@ -79,14 +78,11 @@ public class JPAEdmFunctionImport extends JPAEdmBaseViewImpl implements
private JPAEdmComplexTypeView jpaEdmComplexTypeView = null;
@Override
- public void build() throws ODataJPAModelException,
- ODataJPARuntimeException {
+ public void build() throws ODataJPAModelException, ODataJPARuntimeException {
- HashMap<Class<?>, String[]> customOperations = schemaView
- .getRegisteredOperations();
+ HashMap<Class<?>, String[]> customOperations = schemaView.getRegisteredOperations();
- jpaEdmEntityTypeView = schemaView.getJPAEdmEntityContainerView()
- .getJPAEdmEntitySetView().getJPAEdmEntityTypeView();
+ jpaEdmEntityTypeView = schemaView.getJPAEdmEntityContainerView().getJPAEdmEntitySetView().getJPAEdmEntityTypeView();
jpaEdmComplexTypeView = schemaView.getJPAEdmComplexTypeView();
if (customOperations != null) {
@@ -110,8 +106,7 @@ public class JPAEdmFunctionImport extends JPAEdmBaseViewImpl implements
try {
if (operationNames != null) {
for (Method method2 : methods) {
- if (method2.getName().equals(
- operationNames[i])) {
+ if (method2.getName().equals(operationNames[i])) {
found = true;
method = method2;
break;
@@ -128,24 +123,20 @@ public class JPAEdmFunctionImport extends JPAEdmBaseViewImpl implements
FunctionImport functionImport = buildFunctionImport(method);
if (functionImport != null) {
- consistentFunctionImportList
- .add(functionImport);
+ consistentFunctionImportList.add(functionImport);
}
} catch (SecurityException e) {
- throw ODataJPAModelException.throwException(
- ODataJPAModelException.GENERAL, e);
+ throw ODataJPAModelException.throwException(ODataJPAModelException.GENERAL, e);
}
}
}
}
}
- private FunctionImport buildFunctionImport(final Method method)
- throws ODataJPAModelException {
+ private FunctionImport buildFunctionImport(final Method method) throws ODataJPAModelException {
- org.apache.olingo.odata2.api.annotation.edm.FunctionImport annotation = method
- .getAnnotation(org.apache.olingo.odata2.api.annotation.edm.FunctionImport.class);
+ org.apache.olingo.odata2.api.annotation.edm.FunctionImport annotation = method.getAnnotation(org.apache.olingo.odata2.api.annotation.edm.FunctionImport.class);
if (annotation != null && annotation.returnType() != ReturnType.NONE) {
FunctionImport functionImport = new FunctionImport();
@@ -170,8 +161,7 @@ public class JPAEdmFunctionImport extends JPAEdmBaseViewImpl implements
return null;
}
- private void buildParameter(final FunctionImport functionImport, final Method method)
- throws ODataJPAModelException {
+ private void buildParameter(final FunctionImport functionImport, final Method method) throws ODataJPAModelException {
Annotation[][] annotations = method.getParameterAnnotations();
Class<?>[] parameterTypes = method.getParameterTypes();
@@ -186,20 +176,13 @@ public class JPAEdmFunctionImport extends JPAEdmBaseViewImpl implements
Parameter annotation = (Parameter) element;
FunctionImportParameter functionImportParameter = new FunctionImportParameter();
if (annotation.name().equals("")) {
- throw ODataJPAModelException.throwException(
- ODataJPAModelException.FUNC_PARAM_NAME_EXP
- .addContent(method
- .getDeclaringClass()
- .getName(), method
- .getName()), null);
+ throw ODataJPAModelException.throwException(ODataJPAModelException.FUNC_PARAM_NAME_EXP.addContent(method.getDeclaringClass().getName(), method.getName()), null);
} else {
functionImportParameter.setName(annotation.name());
}
- functionImportParameter.setType(JPATypeConvertor
- .convertToEdmSimpleType(parameterType, null));
- functionImportParameter.setMode(annotation.mode()
- .toString());
+ functionImportParameter.setType(JPATypeConvertor.convertToEdmSimpleType(parameterType, null));
+ functionImportParameter.setMode(annotation.mode().toString());
Facets facets = new Facets();
if (annotation.facets().maxLength() > 0) {
@@ -231,10 +214,7 @@ public class JPAEdmFunctionImport extends JPAEdmBaseViewImpl implements
}
}
- private void buildReturnType(final FunctionImport functionImport,
- final Method method,
- final org.apache.olingo.odata2.api.annotation.edm.FunctionImport annotation)
- throws ODataJPAModelException {
+ private void buildReturnType(final FunctionImport functionImport, final Method method, final org.apache.olingo.odata2.api.annotation.edm.FunctionImport annotation) throws ODataJPAModelException {
ReturnType returnType = annotation.returnType();
Multiplicity multiplicity = null;
@@ -251,79 +231,46 @@ public class JPAEdmFunctionImport extends JPAEdmBaseViewImpl implements
if (returnType == ReturnType.ENTITY_TYPE) {
String entitySet = annotation.entitySet();
if (entitySet.equals("")) {
- throw ODataJPAModelException
- .throwException(
- ODataJPAModelException.FUNC_ENTITYSET_EXP,
- null);
+ throw ODataJPAModelException.throwException(ODataJPAModelException.FUNC_ENTITYSET_EXP, null);
}
functionImport.setEntitySet(entitySet);
}
Class<?> methodReturnType = method.getReturnType();
- if (methodReturnType == null
- || methodReturnType.getName().equals("void")) {
- throw ODataJPAModelException.throwException(
- ODataJPAModelException.FUNC_RETURN_TYPE_EXP
- .addContent(method.getDeclaringClass(),
- method.getName()), null);
+ if (methodReturnType == null || methodReturnType.getName().equals("void")) {
+ throw ODataJPAModelException.throwException(ODataJPAModelException.FUNC_RETURN_TYPE_EXP.addContent(method.getDeclaringClass(), method.getName()), null);
}
switch (returnType) {
case ENTITY_TYPE:
EntityType edmEntityType = null;
if (multiplicity == Multiplicity.ONE) {
- edmEntityType = jpaEdmEntityTypeView
- .searchEdmEntityType(methodReturnType
- .getSimpleName());
+ edmEntityType = jpaEdmEntityTypeView.searchEdmEntityType(methodReturnType.getSimpleName());
} else if (multiplicity == Multiplicity.MANY) {
- edmEntityType = jpaEdmEntityTypeView
- .searchEdmEntityType(getReturnTypeSimpleName(method));
+ edmEntityType = jpaEdmEntityTypeView.searchEdmEntityType(getReturnTypeSimpleName(method));
}
if (edmEntityType == null) {
- throw ODataJPAModelException
- .throwException(
- ODataJPAModelException.FUNC_RETURN_TYPE_ENTITY_NOT_FOUND
- .addContent(
- method.getDeclaringClass(),
- method.getName(),
- methodReturnType
- .getSimpleName()),
- null);
+ throw ODataJPAModelException.throwException(ODataJPAModelException.FUNC_RETURN_TYPE_ENTITY_NOT_FOUND.addContent(method.getDeclaringClass(), method.getName(), methodReturnType.getSimpleName()), null);
}
- functionReturnType.setTypeName(JPAEdmNameBuilder.build(
- schemaView, edmEntityType.getName()));
+ functionReturnType.setTypeName(JPAEdmNameBuilder.build(schemaView, edmEntityType.getName()));
break;
case SCALAR:
- EdmSimpleTypeKind edmSimpleTypeKind = JPATypeConvertor
- .convertToEdmSimpleType(methodReturnType, null);
- functionReturnType.setTypeName(edmSimpleTypeKind
- .getFullQualifiedName());
+ EdmSimpleTypeKind edmSimpleTypeKind = JPATypeConvertor.convertToEdmSimpleType(methodReturnType, null);
+ functionReturnType.setTypeName(edmSimpleTypeKind.getFullQualifiedName());
break;
case COMPLEX_TYPE:
ComplexType complexType = null;
if (multiplicity == Multiplicity.ONE) {
- complexType = jpaEdmComplexTypeView
- .searchEdmComplexType(methodReturnType
- .getName());
+ complexType = jpaEdmComplexTypeView.searchEdmComplexType(methodReturnType.getName());
} else if (multiplicity == Multiplicity.MANY) {
- complexType = jpaEdmComplexTypeView
- .searchEdmComplexType(getReturnTypeName(method));
+ complexType = jpaEdmComplexTypeView.searchEdmComplexType(getReturnTypeName(method));
}
if (complexType == null) {
- throw ODataJPAModelException
- .throwException(
- ODataJPAModelException.FUNC_RETURN_TYPE_ENTITY_NOT_FOUND
- .addContent(
- method.getDeclaringClass(),
- method.getName(),
- methodReturnType
- .getSimpleName()),
- null);
+ throw ODataJPAModelException.throwException(ODataJPAModelException.FUNC_RETURN_TYPE_ENTITY_NOT_FOUND.addContent(method.getDeclaringClass(), method.getName(), methodReturnType.getSimpleName()), null);
}
- functionReturnType.setTypeName(JPAEdmNameBuilder.build(
- schemaView, complexType.getName()));
+ functionReturnType.setTypeName(JPAEdmNameBuilder.build(schemaView, complexType.getName()));
break;
default:
break;
@@ -334,8 +281,7 @@ public class JPAEdmFunctionImport extends JPAEdmBaseViewImpl implements
private String getReturnTypeName(final Method method) {
try {
- ParameterizedType pt = (ParameterizedType) method
- .getGenericReturnType();
+ ParameterizedType pt = (ParameterizedType) method.getGenericReturnType();
Type t = pt.getActualTypeArguments()[0];
return ((Class<?>) t).getName();
} catch (ClassCastException e) {
@@ -345,8 +291,7 @@ public class JPAEdmFunctionImport extends JPAEdmBaseViewImpl implements
private String getReturnTypeSimpleName(final Method method) {
try {
- ParameterizedType pt = (ParameterizedType) method
- .getGenericReturnType();
+ ParameterizedType pt = (ParameterizedType) method.getGenericReturnType();
Type t = pt.getActualTypeArguments()[0];
return ((Class<?>) t).getSimpleName();
} catch (ClassCastException e) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmKey.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmKey.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmKey.java
index bc4a370..cfe47fc 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmKey.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmKey.java
@@ -46,8 +46,7 @@ public class JPAEdmKey extends JPAEdmBaseViewImpl implements JPAEdmKeyView {
propertyView = view;
}
- public JPAEdmKey(final JPAEdmComplexTypeView complexTypeView,
- final JPAEdmPropertyView propertyView) {
+ public JPAEdmKey(final JPAEdmComplexTypeView complexTypeView, final JPAEdmPropertyView propertyView) {
super(complexTypeView);
this.propertyView = propertyView;
this.complexTypeView = complexTypeView;
@@ -86,9 +85,7 @@ public class JPAEdmKey extends JPAEdmBaseViewImpl implements JPAEdmKeyView {
}
if (isBuildModeComplexType) {
- ComplexType complexType = complexTypeView
- .searchEdmComplexType(propertyView
- .getJPAAttribute().getJavaType().getName());
+ ComplexType complexType = complexTypeView.searchEdmComplexType(propertyView.getJPAAttribute().getJavaType().getName());
normalizeComplexKey(complexType, propertyRefList);
} else {
PropertyRef propertyRef = new PropertyRef();
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/1e5280b7/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmNavigationProperty.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmNavigationProperty.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmNavigationProperty.java
index d5e16f6..7224bc6 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmNavigationProperty.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/model/JPAEdmNavigationProperty.java
@@ -30,8 +30,7 @@ import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmPropertyView;
import org.apache.olingo.odata2.processor.api.jpa.model.JPAEdmSchemaView;
import org.apache.olingo.odata2.processor.core.jpa.access.model.JPAEdmNameBuilder;
-public class JPAEdmNavigationProperty extends JPAEdmBaseViewImpl implements
- JPAEdmNavigationPropertyView {
+public class JPAEdmNavigationProperty extends JPAEdmBaseViewImpl implements JPAEdmNavigationPropertyView {
private JPAEdmAssociationView associationView = null;
private NavigationProperty currentNavigationProperty = null;
@@ -39,14 +38,12 @@ public class JPAEdmNavigationProperty extends JPAEdmBaseViewImpl implements
private List<NavigationProperty> consistentNavigationProperties = null;
private int count;
- public JPAEdmNavigationProperty(final JPAEdmAssociationView associationView,
- final JPAEdmPropertyView propertyView, final int countNumber) {
+ public JPAEdmNavigationProperty(final JPAEdmAssociationView associationView, final JPAEdmPropertyView propertyView, final int countNumber) {
super(associationView);
this.associationView = associationView;
this.propertyView = propertyView;
count = countNumber;
- if (consistentNavigationProperties == null)
- {
+ if (consistentNavigationProperties == null) {
consistentNavigationProperties = new ArrayList<NavigationProperty>();
}
}
@@ -72,8 +69,7 @@ public class JPAEdmNavigationProperty extends JPAEdmBaseViewImpl implements
public void build() throws ODataJPAModelException {
currentNavigationProperty = new NavigationProperty();
- JPAEdmNameBuilder.build(associationView, propertyView,
- JPAEdmNavigationProperty.this, count);
+ JPAEdmNameBuilder.build(associationView, propertyView, JPAEdmNavigationProperty.this, count);
consistentNavigationProperties.add(currentNavigationProperty);
}
@@ -90,8 +86,7 @@ public class JPAEdmNavigationProperty extends JPAEdmBaseViewImpl implements
}
@Override
- public void addJPAEdmNavigationPropertyView(
- final JPAEdmNavigationPropertyView view) {
+ public void addJPAEdmNavigationPropertyView(final JPAEdmNavigationPropertyView view) {
if (view != null && view.isConsistent()) {
currentNavigationProperty = view.getEdmNavigationProperty();
consistentNavigationProperties.add(currentNavigationProperty);