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:05 UTC
[20/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/access/model/JPAEdmMappingModelService.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/access/model/JPAEdmMappingModelService.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/access/model/JPAEdmMappingModelService.java
index 69b94de..8d4d69e 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/access/model/JPAEdmMappingModelService.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/access/model/JPAEdmMappingModelService.java
@@ -70,8 +70,7 @@ public class JPAEdmMappingModelService implements JPAEdmMappingModelAccess {
} catch (JAXBException e) {
mappingModelExists = false;
- ODataJPAModelException.throwException(
- ODataJPAModelException.GENERAL, e);
+ ODataJPAModelException.throwException(ODataJPAModelException.GENERAL, e);
}
}
}
@@ -89,8 +88,7 @@ public class JPAEdmMappingModelService implements JPAEdmMappingModelAccess {
@Override
public String mapJPAPersistenceUnit(final String persistenceUnitName) {
- JPAPersistenceUnitMapType persistenceUnit = mappingModel
- .getPersistenceUnit();
+ JPAPersistenceUnitMapType persistenceUnit = mappingModel.getPersistenceUnit();
if (persistenceUnit.getName().equals(persistenceUnitName)) {
return persistenceUnit.getEDMSchemaNamespace();
}
@@ -120,16 +118,13 @@ public class JPAEdmMappingModelService implements JPAEdmMappingModelAccess {
}
@Override
- public String mapJPAAttribute(final String jpaEntityTypeName,
- final String jpaAttributeName) {
+ public String mapJPAAttribute(final String jpaEntityTypeName, final String jpaAttributeName) {
JPAEntityTypeMapType jpaEntityTypeMap = searchJPAEntityTypeMapType(jpaEntityTypeName);
- if (jpaEntityTypeMap != null
- && jpaEntityTypeMap.getJPAAttributes() != null) {
+ if (jpaEntityTypeMap != null && jpaEntityTypeMap.getJPAAttributes() != null) {
// fixing attributes
// removal issue
// from mapping
- for (JPAAttribute jpaAttribute : jpaEntityTypeMap
- .getJPAAttributes().getJPAAttribute()) {
+ for (JPAAttribute jpaAttribute : jpaEntityTypeMap.getJPAAttributes().getJPAAttribute()) {
if (jpaAttribute.getName().equals(jpaAttributeName)) {
return jpaAttribute.getValue();
}
@@ -140,12 +135,10 @@ public class JPAEdmMappingModelService implements JPAEdmMappingModelAccess {
}
@Override
- public String mapJPARelationship(final String jpaEntityTypeName,
- final String jpaRelationshipName) {
+ public String mapJPARelationship(final String jpaEntityTypeName, final String jpaRelationshipName) {
JPAEntityTypeMapType jpaEntityTypeMap = searchJPAEntityTypeMapType(jpaEntityTypeName);
if (jpaEntityTypeMap != null) {
- for (JPARelationship jpaRealtionship : jpaEntityTypeMap
- .getJPARelationships().getJPARelationship()) {
+ for (JPARelationship jpaRealtionship : jpaEntityTypeMap.getJPARelationships().getJPARelationship()) {
if (jpaRealtionship.getName().equals(jpaRelationshipName)) {
return jpaRealtionship.getValue();
}
@@ -166,12 +159,10 @@ public class JPAEdmMappingModelService implements JPAEdmMappingModelAccess {
}
@Override
- public String mapJPAEmbeddableTypeAttribute(final String jpaEmbeddableTypeName,
- final String jpaAttributeName) {
+ public String mapJPAEmbeddableTypeAttribute(final String jpaEmbeddableTypeName, final String jpaAttributeName) {
JPAEmbeddableTypeMapType jpaEmbeddableType = searchJPAEmbeddableTypeMapType(jpaEmbeddableTypeName);
if (jpaEmbeddableType != null && jpaEmbeddableType.getJPAAttributes() != null) {
- for (JPAAttribute jpaAttribute : jpaEmbeddableType
- .getJPAAttributes().getJPAAttribute()) {
+ for (JPAAttribute jpaAttribute : jpaEmbeddableType.getJPAAttributes().getJPAAttribute()) {
if (jpaAttribute.getName().equals(jpaAttributeName)) {
return jpaAttribute.getValue();
}
@@ -180,10 +171,8 @@ public class JPAEdmMappingModelService implements JPAEdmMappingModelAccess {
return null;
}
- private JPAEntityTypeMapType searchJPAEntityTypeMapType(
- final String jpaEntityTypeName) {
- for (JPAEntityTypeMapType jpaEntityType : mappingModel
- .getPersistenceUnit().getJPAEntityTypes().getJPAEntityType()) {
+ private JPAEntityTypeMapType searchJPAEntityTypeMapType(final String jpaEntityTypeName) {
+ for (JPAEntityTypeMapType jpaEntityType : mappingModel.getPersistenceUnit().getJPAEntityTypes().getJPAEntityType()) {
if (jpaEntityType.getName().equals(jpaEntityTypeName)) {
return jpaEntityType;
}
@@ -192,11 +181,8 @@ public class JPAEdmMappingModelService implements JPAEdmMappingModelAccess {
return null;
}
- private JPAEmbeddableTypeMapType searchJPAEmbeddableTypeMapType(
- final String jpaEmbeddableTypeName) {
- for (JPAEmbeddableTypeMapType jpaEmbeddableType : mappingModel
- .getPersistenceUnit().getJPAEmbeddableTypes()
- .getJPAEmbeddableType()) {
+ private JPAEmbeddableTypeMapType searchJPAEmbeddableTypeMapType(final String jpaEmbeddableTypeName) {
+ for (JPAEmbeddableTypeMapType jpaEmbeddableType : mappingModel.getPersistenceUnit().getJPAEmbeddableTypes().getJPAEmbeddableType()) {
if (jpaEmbeddableType.getName().equals(jpaEmbeddableTypeName)) {
return jpaEmbeddableType;
}
@@ -206,8 +192,7 @@ public class JPAEdmMappingModelService implements JPAEdmMappingModelAccess {
}
protected InputStream loadMappingModelInputStream() {
- InputStream is = JPAEdmMappingModelService.class.getClassLoader()
- .getResourceAsStream("../../" + mappingModelName);
+ InputStream is = JPAEdmMappingModelService.class.getClassLoader().getResourceAsStream("../../" + mappingModelName);
return is;
@@ -223,12 +208,10 @@ public class JPAEdmMappingModelService implements JPAEdmMappingModelAccess {
}
@Override
- public boolean checkExclusionOfJPAAttributeType(final String jpaEntityTypeName,
- final String jpaAttributeName) {
+ public boolean checkExclusionOfJPAAttributeType(final String jpaEntityTypeName, final String jpaAttributeName) {
JPAEntityTypeMapType type = searchJPAEntityTypeMapType(jpaEntityTypeName);
if (type != null && type.getJPAAttributes() != null) {
- for (JPAAttribute jpaAttribute : type.getJPAAttributes()
- .getJPAAttribute()) {
+ for (JPAAttribute jpaAttribute : type.getJPAAttributes().getJPAAttribute()) {
if (jpaAttribute.getName().equals(jpaAttributeName)) {
return jpaAttribute.isExclude();
}
@@ -238,8 +221,7 @@ public class JPAEdmMappingModelService implements JPAEdmMappingModelAccess {
}
@Override
- public boolean checkExclusionOfJPAEmbeddableType(
- final String jpaEmbeddableTypeName) {
+ public boolean checkExclusionOfJPAEmbeddableType(final String jpaEmbeddableTypeName) {
JPAEmbeddableTypeMapType type = searchJPAEmbeddableTypeMapType(jpaEmbeddableTypeName);
if (type != null) {
return type.isExclude();
@@ -248,12 +230,10 @@ public class JPAEdmMappingModelService implements JPAEdmMappingModelAccess {
}
@Override
- public boolean checkExclusionOfJPAEmbeddableAttributeType(
- final String jpaEmbeddableTypeName, final String jpaAttributeName) {
+ public boolean checkExclusionOfJPAEmbeddableAttributeType(final String jpaEmbeddableTypeName, final String jpaAttributeName) {
JPAEmbeddableTypeMapType type = searchJPAEmbeddableTypeMapType(jpaEmbeddableTypeName);
if (type != null && type.getJPAAttributes() != null) {
- for (JPAAttribute jpaAttribute : type.getJPAAttributes()
- .getJPAAttribute()) {
+ for (JPAAttribute jpaAttribute : type.getJPAAttributes().getJPAAttribute()) {
if (jpaAttribute.getName().equals(jpaAttributeName)) {
return jpaAttribute.isExclude();
}
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/access/model/JPAEdmNameBuilder.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/access/model/JPAEdmNameBuilder.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/access/model/JPAEdmNameBuilder.java
index 271455d..dd1eea3 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/access/model/JPAEdmNameBuilder.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/access/model/JPAEdmNameBuilder.java
@@ -58,8 +58,7 @@ public class JPAEdmNameBuilder {
private static final String UNDERSCORE = "_";
public static FullQualifiedName build(final JPAEdmBaseView view, final String name) {
- FullQualifiedName fqName = new FullQualifiedName(buildNamespace(view),
- name);
+ FullQualifiedName fqName = new FullQualifiedName(buildNamespace(view), name);
return fqName;
}
@@ -77,13 +76,10 @@ public class JPAEdmNameBuilder {
EntityType edmEntityType = view.getEdmEntityType();
String jpaEntityName = view.getJPAEntityType().getName();
- JPAEdmMappingModelAccess mappingModelAccess = view
- .getJPAEdmMappingModelAccess();
+ JPAEdmMappingModelAccess mappingModelAccess = view.getJPAEdmMappingModelAccess();
String edmEntityTypeName = null;
- if (mappingModelAccess != null
- && mappingModelAccess.isMappingModelExists()) {
- edmEntityTypeName = mappingModelAccess
- .mapJPAEntityType(jpaEntityName);
+ if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) {
+ edmEntityTypeName = mappingModelAccess.mapJPAEntityType(jpaEntityName);
}
JPAEdmMapping mapping = new JPAEdmMappingImpl();
@@ -93,8 +89,7 @@ public class JPAEdmNameBuilder {
edmEntityTypeName = jpaEntityName;
}
//Setting the mapping object
- edmEntityType.setMapping(((Mapping) mapping)
- .setInternalName(jpaEntityName));
+ edmEntityType.setMapping(((Mapping) mapping).setInternalName(jpaEntityName));
edmEntityType.setName(edmEntityTypeName);
@@ -109,8 +104,7 @@ public class JPAEdmNameBuilder {
* EDM Schema Name - RULES
* ************************************************************************
*/
- public static void build(final JPAEdmSchemaView view)
- throws ODataJPAModelException {
+ public static void build(final JPAEdmSchemaView view) throws ODataJPAModelException {
view.getEdmSchema().setNamespace(buildNamespace(view));
}
@@ -132,25 +126,16 @@ public class JPAEdmNameBuilder {
String jpaAttributeName = jpaAttribute.getName();
String propertyName = null;
- JPAEdmMappingModelAccess mappingModelAccess = view
- .getJPAEdmMappingModelAccess();
- if (mappingModelAccess != null
- && mappingModelAccess.isMappingModelExists()) {
+ JPAEdmMappingModelAccess mappingModelAccess = view.getJPAEdmMappingModelAccess();
+ if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) {
if (isComplexMode) {
- propertyName = mappingModelAccess
- .mapJPAEmbeddableTypeAttribute(view
- .getJPAEdmComplexTypeView()
- .getJPAEmbeddableType().getJavaType()
- .getSimpleName(), jpaAttributeName);
+ propertyName = mappingModelAccess.mapJPAEmbeddableTypeAttribute(view.getJPAEdmComplexTypeView().getJPAEmbeddableType().getJavaType().getSimpleName(), jpaAttributeName);
} else {
- propertyName = mappingModelAccess.mapJPAAttribute(
- view.getJPAEdmEntityTypeView().getJPAEntityType()
- .getName(), jpaAttributeName);
+ propertyName = mappingModelAccess.mapJPAAttribute(view.getJPAEdmEntityTypeView().getJPAEntityType().getName(), jpaAttributeName);
}
}
if (propertyName == null) {
- propertyName = Character.toUpperCase(jpaAttributeName.charAt(0))
- + jpaAttributeName.substring(1);
+ propertyName = Character.toUpperCase(jpaAttributeName.charAt(0)) + jpaAttributeName.substring(1);
}
view.getEdmSimpleProperty().setName(propertyName);
@@ -158,8 +143,7 @@ public class JPAEdmNameBuilder {
JPAEdmMapping mapping = new JPAEdmMappingImpl();
((Mapping) mapping).setInternalName(jpaAttributeName);
- AnnotatedElement annotatedElement = (AnnotatedElement) jpaAttribute
- .getJavaMember();
+ AnnotatedElement annotatedElement = (AnnotatedElement) jpaAttribute.getJavaMember();
if (annotatedElement != null) {
Column column = annotatedElement.getAnnotation(Column.class);
if (column != null) {
@@ -196,8 +180,7 @@ public class JPAEdmNameBuilder {
* ************************************************************************
*/
public static void build(final JPAEdmEntityContainerView view) {
- view.getEdmEntityContainer().setName(
- buildNamespace(view) + ENTITY_CONTAINER_SUFFIX);
+ view.getEdmEntityContainer().setName(buildNamespace(view) + ENTITY_CONTAINER_SUFFIX);
}
/*
@@ -209,18 +192,14 @@ public class JPAEdmNameBuilder {
* EDM EntitySet Name - RULES
* ************************************************************************
*/
- public static void build(final JPAEdmEntitySetView view,
- final JPAEdmEntityTypeView entityTypeView) {
+ public static void build(final JPAEdmEntitySetView view, final JPAEdmEntityTypeView entityTypeView) {
FullQualifiedName fQname = view.getEdmEntitySet().getEntityType();
- JPAEdmMappingModelAccess mappingModelAccess = view
- .getJPAEdmMappingModelAccess();
+ JPAEdmMappingModelAccess mappingModelAccess = view.getJPAEdmMappingModelAccess();
String entitySetName = null;
- if (mappingModelAccess != null
- && mappingModelAccess.isMappingModelExists()) {
+ if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) {
Mapping mapping = entityTypeView.getEdmEntityType().getMapping();
if (mapping != null) {
- entitySetName = mappingModelAccess.mapJPAEntitySet(mapping
- .getInternalName());
+ entitySetName = mappingModelAccess.mapJPAEntitySet(mapping.getInternalName());
}
}
@@ -242,15 +221,11 @@ public class JPAEdmNameBuilder {
*/
public static void build(final JPAEdmComplexType view) {
- JPAEdmMappingModelAccess mappingModelAccess = view
- .getJPAEdmMappingModelAccess();
- String jpaEmbeddableTypeName = view.getJPAEmbeddableType()
- .getJavaType().getSimpleName();
+ JPAEdmMappingModelAccess mappingModelAccess = view.getJPAEdmMappingModelAccess();
+ String jpaEmbeddableTypeName = view.getJPAEmbeddableType().getJavaType().getSimpleName();
String edmComplexTypeName = null;
- if (mappingModelAccess != null
- && mappingModelAccess.isMappingModelExists()) {
- edmComplexTypeName = mappingModelAccess
- .mapJPAEmbeddableType(jpaEmbeddableTypeName);
+ if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) {
+ edmComplexTypeName = mappingModelAccess.mapJPAEmbeddableType(jpaEmbeddableTypeName);
}
if (edmComplexTypeName == null) {
@@ -273,28 +248,22 @@ public class JPAEdmNameBuilder {
* EDM Complex Property Name - RULES
* ************************************************************************
*/
- public static void build(final JPAEdmComplexPropertyView complexView,
- final JPAEdmPropertyView propertyView) {
+ public static void build(final JPAEdmComplexPropertyView complexView, final JPAEdmPropertyView propertyView) {
ComplexProperty complexProperty = complexView.getEdmComplexProperty();
String jpaAttributeName = propertyView.getJPAAttribute().getName();
- String jpaEntityTypeName = propertyView.getJPAEdmEntityTypeView()
- .getJPAEntityType().getName();
+ String jpaEntityTypeName = propertyView.getJPAEdmEntityTypeView().getJPAEntityType().getName();
- JPAEdmMappingModelAccess mappingModelAccess = complexView
- .getJPAEdmMappingModelAccess();
+ JPAEdmMappingModelAccess mappingModelAccess = complexView.getJPAEdmMappingModelAccess();
String propertyName = null;
- if (mappingModelAccess != null
- && mappingModelAccess.isMappingModelExists()) {
- propertyName = mappingModelAccess.mapJPAAttribute(
- jpaEntityTypeName, jpaAttributeName);
+ if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) {
+ propertyName = mappingModelAccess.mapJPAAttribute(jpaEntityTypeName, jpaAttributeName);
}
if (propertyName == null) {
- propertyName = Character.toUpperCase(jpaAttributeName.charAt(0))
- + jpaAttributeName.substring(1);
+ propertyName = Character.toUpperCase(jpaAttributeName.charAt(0)) + jpaAttributeName.substring(1);
}
// change for navigation property issue
JPAEdmMapping mapping = new JPAEdmMappingImpl();
@@ -306,22 +275,18 @@ public class JPAEdmNameBuilder {
}
- public static void build(final JPAEdmComplexPropertyView complexView, final String parentComplexTypeName)
- {
+ public static void build(final JPAEdmComplexPropertyView complexView, final String parentComplexTypeName) {
ComplexProperty complexProperty = complexView.getEdmComplexProperty();
JPAEdmMappingModelAccess mappingModelAccess = complexView.getJPAEdmMappingModelAccess();
JPAEdmPropertyView propertyView = ((JPAEdmPropertyView) complexView);
String jpaAttributeName = propertyView.getJPAAttribute().getName();
String propertyName = null;
- if (mappingModelAccess != null
- && mappingModelAccess.isMappingModelExists()) {
- propertyName = mappingModelAccess.mapJPAEmbeddableTypeAttribute(
- parentComplexTypeName, jpaAttributeName);
+ if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) {
+ propertyName = mappingModelAccess.mapJPAEmbeddableTypeAttribute(parentComplexTypeName, jpaAttributeName);
}
if (propertyName == null) {
- propertyName = Character.toUpperCase(jpaAttributeName.charAt(0))
- + jpaAttributeName.substring(1);
+ propertyName = Character.toUpperCase(jpaAttributeName.charAt(0)) + jpaAttributeName.substring(1);
}
JPAEdmMapping mapping = new JPAEdmMappingImpl();
((Mapping) mapping).setInternalName(jpaAttributeName);
@@ -340,8 +305,7 @@ public class JPAEdmNameBuilder {
* EDM Association End Name - RULES
* ************************************************************************
*/
- public static void build(final JPAEdmAssociationEndView assocaitionEndView,
- final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView) {
+ public static void build(final JPAEdmAssociationEndView assocaitionEndView, final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView) {
String namespace = buildNamespace(assocaitionEndView);
@@ -353,22 +317,17 @@ public class JPAEdmNameBuilder {
String jpaEntityTypeName = null;
try {
- PluralAttribute<?, ?, ?> jpattr = (PluralAttribute<?, ?, ?>) propertyView
- .getJPAAttribute();
+ PluralAttribute<?, ?, ?> jpattr = (PluralAttribute<?, ?, ?>) propertyView.getJPAAttribute();
- jpaEntityTypeName = jpattr.getElementType().getJavaType()
- .getSimpleName();
+ jpaEntityTypeName = jpattr.getElementType().getJavaType().getSimpleName();
} catch (Exception e) {
- jpaEntityTypeName = propertyView.getJPAAttribute().getJavaType()
- .getSimpleName();
+ jpaEntityTypeName = propertyView.getJPAAttribute().getJavaType().getSimpleName();
}
- JPAEdmMappingModelAccess mappingModelAccess = assocaitionEndView
- .getJPAEdmMappingModelAccess();
+ JPAEdmMappingModelAccess mappingModelAccess = assocaitionEndView.getJPAEdmMappingModelAccess();
- if (mappingModelAccess != null
- && mappingModelAccess.isMappingModelExists()) {
+ if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) {
name = mappingModelAccess.mapJPAEntityType(jpaEntityTypeName);
}
@@ -382,13 +341,10 @@ public class JPAEdmNameBuilder {
}
private static String buildNamespace(final JPAEdmBaseView view) {
- JPAEdmMappingModelAccess mappingModelAccess = view
- .getJPAEdmMappingModelAccess();
+ JPAEdmMappingModelAccess mappingModelAccess = view.getJPAEdmMappingModelAccess();
String namespace = null;
- if (mappingModelAccess != null
- && mappingModelAccess.isMappingModelExists()) {
- namespace = mappingModelAccess.mapJPAPersistenceUnit(view
- .getpUnitName());
+ if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) {
+ namespace = mappingModelAccess.mapJPAPersistenceUnit(view.getpUnitName());
}
if (namespace == null) {
namespace = view.getpUnitName();
@@ -442,9 +398,7 @@ public class JPAEdmNameBuilder {
}
- public static void build(final JPAEdmAssociationView associationView,
- final JPAEdmPropertyView propertyView,
- final JPAEdmNavigationPropertyView navPropertyView, final int count) {
+ public static void build(final JPAEdmAssociationView associationView, final JPAEdmPropertyView propertyView, final JPAEdmNavigationPropertyView navPropertyView, final int count) {
String toName = null;
String fromName = null;
@@ -453,34 +407,24 @@ public class JPAEdmNameBuilder {
String namespace = buildNamespace(associationView);
Association association = associationView.getEdmAssociation();
- navProp.setRelationship(new FullQualifiedName(namespace, association
- .getName()));
+ navProp.setRelationship(new FullQualifiedName(namespace, association.getName()));
- FullQualifiedName associationEndTypeOne = association.getEnd1()
- .getType();
- FullQualifiedName associationEndTypeTwo = association.getEnd2()
- .getType();
+ FullQualifiedName associationEndTypeOne = association.getEnd1().getType();
+ FullQualifiedName associationEndTypeTwo = association.getEnd2().getType();
Attribute<?, ?> jpaAttribute = propertyView.getJPAAttribute();
navProp.setMapping(new Mapping().setInternalName(jpaAttribute.getName()));
- String jpaEntityTypeName = propertyView.getJPAEdmEntityTypeView()
- .getJPAEntityType().getName();
- JPAEdmMappingModelAccess mappingModelAccess = navPropertyView
- .getJPAEdmMappingModelAccess();
+ String jpaEntityTypeName = propertyView.getJPAEdmEntityTypeView().getJPAEntityType().getName();
+ JPAEdmMappingModelAccess mappingModelAccess = navPropertyView.getJPAEdmMappingModelAccess();
try {
- PluralAttribute<?, ?, ?> jpattr = (PluralAttribute<?, ?, ?>) propertyView
- .getJPAAttribute();
-
- if (mappingModelAccess != null
- && mappingModelAccess.isMappingModelExists()) {
- toName = mappingModelAccess.mapJPAEntityType(jpattr
- .getElementType().getJavaType().getSimpleName());
- fromName = mappingModelAccess
- .mapJPAEntityType(jpaEntityTypeName);
- navPropName = mappingModelAccess.mapJPARelationship(
- jpaEntityTypeName, jpattr.getName());
+ PluralAttribute<?, ?, ?> jpattr = (PluralAttribute<?, ?, ?>) propertyView.getJPAAttribute();
+
+ if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) {
+ toName = mappingModelAccess.mapJPAEntityType(jpattr.getElementType().getJavaType().getSimpleName());
+ fromName = mappingModelAccess.mapJPAEntityType(jpaEntityTypeName);
+ navPropName = mappingModelAccess.mapJPARelationship(jpaEntityTypeName, jpattr.getName());
}
if (toName == null) {
toName = jpattr.getElementType().getJavaType().getSimpleName();
@@ -506,14 +450,10 @@ public class JPAEdmNameBuilder {
}
} catch (Exception e) {
- if (mappingModelAccess != null
- && mappingModelAccess.isMappingModelExists()) {
- navPropName = mappingModelAccess.mapJPARelationship(
- jpaEntityTypeName, jpaAttribute.getName());
- toName = mappingModelAccess.mapJPAEntityType(jpaAttribute
- .getJavaType().getSimpleName());
- fromName = mappingModelAccess
- .mapJPAEntityType(jpaEntityTypeName);
+ if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) {
+ navPropName = mappingModelAccess.mapJPARelationship(jpaEntityTypeName, jpaAttribute.getName());
+ toName = mappingModelAccess.mapJPAEntityType(jpaAttribute.getJavaType().getSimpleName());
+ fromName = mappingModelAccess.mapJPAEntityType(jpaEntityTypeName);
}
if (toName == null) {
toName = jpaAttribute.getJavaType().getSimpleName();
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/access/model/JPATypeConvertor.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/access/model/JPATypeConvertor.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/access/model/JPATypeConvertor.java
index 931da2b..879d919 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/access/model/JPATypeConvertor.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/access/model/JPATypeConvertor.java
@@ -55,38 +55,27 @@ public class JPATypeConvertor {
public static EdmSimpleTypeKind convertToEdmSimpleType(final Class<?> jpaType, final Attribute<?, ?> currentAttribute) throws ODataJPAModelException {
if (jpaType.equals(String.class)) {
return EdmSimpleTypeKind.String;
- }
- else if (jpaType.equals(Long.class) || jpaType.equals(long.class)) {
+ } else if (jpaType.equals(Long.class) || jpaType.equals(long.class)) {
return EdmSimpleTypeKind.Int64;
- }
- else if (jpaType.equals(Short.class) || jpaType.equals(short.class)) {
+ } else if (jpaType.equals(Short.class) || jpaType.equals(short.class)) {
return EdmSimpleTypeKind.Int16;
- }
- else if (jpaType.equals(Integer.class) || jpaType.equals(int.class)) {
+ } else if (jpaType.equals(Integer.class) || jpaType.equals(int.class)) {
return EdmSimpleTypeKind.Int32;
- }
- else if (jpaType.equals(Double.class) || jpaType.equals(double.class)) {
+ } else if (jpaType.equals(Double.class) || jpaType.equals(double.class)) {
return EdmSimpleTypeKind.Double;
- }
- else if (jpaType.equals(Float.class) || jpaType.equals(float.class)) {
+ } else if (jpaType.equals(Float.class) || jpaType.equals(float.class)) {
return EdmSimpleTypeKind.Single;
- }
- else if (jpaType.equals(BigDecimal.class)) {
+ } else if (jpaType.equals(BigDecimal.class)) {
return EdmSimpleTypeKind.Decimal;
- }
- else if (jpaType.equals(byte[].class)) {
+ } else if (jpaType.equals(byte[].class)) {
return EdmSimpleTypeKind.Binary;
- }
- else if (jpaType.equals(Byte.class) || jpaType.equals(byte.class)) {
+ } else if (jpaType.equals(Byte.class) || jpaType.equals(byte.class)) {
return EdmSimpleTypeKind.Byte;
- }
- else if (jpaType.equals(Byte[].class)) {
+ } else if (jpaType.equals(Byte[].class)) {
return EdmSimpleTypeKind.Binary;
- }
- else if (jpaType.equals(Boolean.class) || jpaType.equals(boolean.class)) {
+ } else if (jpaType.equals(Boolean.class) || jpaType.equals(boolean.class)) {
return EdmSimpleTypeKind.Boolean;
- }
- else if ((jpaType.equals(Date.class)) || (jpaType.equals(Calendar.class))) {
+ } else if ((jpaType.equals(Date.class)) || (jpaType.equals(Calendar.class))) {
try {
if ((currentAttribute != null) && (currentAttribute.getDeclaringType().getJavaType().getDeclaredField(currentAttribute.getName()).getAnnotation(Temporal.class).value() == TemporalType.TIME)) {
return EdmSimpleTypeKind.Time;
@@ -94,14 +83,11 @@ public class JPATypeConvertor {
return EdmSimpleTypeKind.DateTime;
}
} catch (NoSuchFieldException e) {
- throw ODataJPAModelException
- .throwException(ODataJPAModelException.GENERAL.addContent(e.getMessage()), e);
+ throw ODataJPAModelException.throwException(ODataJPAModelException.GENERAL.addContent(e.getMessage()), e);
} catch (SecurityException e) {
- throw ODataJPAModelException
- .throwException(ODataJPAModelException.GENERAL.addContent(e.getMessage()), e);
+ throw ODataJPAModelException.throwException(ODataJPAModelException.GENERAL.addContent(e.getMessage()), e);
}
- }
- else if (jpaType.equals(UUID.class)) {
+ } else if (jpaType.equals(UUID.class)) {
return EdmSimpleTypeKind.Guid;
}
throw ODataJPAModelException.throwException(ODataJPAModelException.TYPE_NOT_SUPPORTED.addContent(jpaType.toString()), 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/cud/JPACreateRequest.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/cud/JPACreateRequest.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/cud/JPACreateRequest.java
index 6297f67..25802fe 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/cud/JPACreateRequest.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/cud/JPACreateRequest.java
@@ -69,22 +69,17 @@ public class JPACreateRequest extends JPAWriteRequest {
try {
entityType = entitySet.getEntityType();
} catch (EdmException e3) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e3.getMessage()), e3);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e3.getMessage()), e3);
}
String entityName = null;
try {
- if (entityType.getMapping() != null && entityType.getMapping().getInternalName() != null)
- {
+ if (entityType.getMapping() != null && entityType.getMapping().getInternalName() != null) {
entityName = entityType.getMapping().getInternalName();
} else {
entityName = entityType.getName();
}
} catch (EdmException e1) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e1.getMessage()), e1);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e1.getMessage()), e1);
}
Object jpaEntity = null;
Set<EntityType<?>> entityTypeSet = metamodel.getEntities();
@@ -96,13 +91,9 @@ public class JPACreateRequest extends JPAWriteRequest {
jpaEntity = entityTypeTemp.getJavaType().newInstance();
break;
} catch (InstantiationException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (IllegalAccessException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
}
}
@@ -111,9 +102,7 @@ public class JPACreateRequest extends JPAWriteRequest {
try {
entryValues = parseEntry(entitySet, content, requestContentType, true);
} catch (ODataBadRequestException e1) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e1.getMessage()), e1);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e1.getMessage()), e1);
}
Map<String, Object> propertyValueMap = entryValues.getProperties();
@@ -123,9 +112,7 @@ public class JPACreateRequest extends JPAWriteRequest {
try {
navPropEntitySetMap = createInlinedEntities(jpaEntity, entitySet, entryValues, currentEntityName);
} catch (ODataException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
List<T> objectList = new ArrayList<T>();
objectList.add((T) jpaEntity);
@@ -134,9 +121,7 @@ public class JPACreateRequest extends JPAWriteRequest {
}
@SuppressWarnings("unchecked")
- public final Object parse2JPAEntityValueMap(
- final Object jpaEntity, final EdmStructuralType edmEntityType, final Map<String, Object> propertyValueMap, final String entityName)
- throws ODataJPARuntimeException {
+ public final Object parse2JPAEntityValueMap(final Object jpaEntity, final EdmStructuralType edmEntityType, final Map<String, Object> propertyValueMap, final String entityName) throws ODataJPARuntimeException {
if (jpaEntity == null || edmEntityType == null || propertyValueMap == null || propertyValueMap.size() == 0) {
return null;
@@ -145,20 +130,16 @@ public class JPACreateRequest extends JPAWriteRequest {
String jpaEntityAccessKey = jpaEntity.getClass().getName();
if (!jpaEntityAccessMap.containsKey(jpaEntityAccessKey)) {
- jpaEntityAccessMap.put(jpaEntityAccessKey,
- getSetters(jpaEntity, edmEntityType, true));
+ jpaEntityAccessMap.put(jpaEntityAccessKey, getSetters(jpaEntity, edmEntityType, true));
}
- HashMap<String, Method> setters = jpaEntityAccessMap
- .get(jpaEntityAccessKey);
- HashMap<String, String> embeddableKeys = jpaEmbeddableKeyMap
- .get(jpaEntityAccessKey);
+ HashMap<String, Method> setters = jpaEntityAccessMap.get(jpaEntityAccessKey);
+ HashMap<String, String> embeddableKeys = jpaEmbeddableKeyMap.get(jpaEntityAccessKey);
String propertyName = null;
try {
for (String key : setters.keySet()) {
- EdmProperty property = (EdmProperty) edmEntityType
- .getProperty(key);
+ EdmProperty property = (EdmProperty) edmEntityType.getProperty(key);
if (property.getMapping() != null && property.getMapping().getInternalName() != null) {
propertyName = property.getMapping().getInternalName();
} else {
@@ -176,8 +157,7 @@ public class JPACreateRequest extends JPAWriteRequest {
if (method != null) {
if (property.getType().getKind().equals(EdmTypeKind.COMPLEX)) {
Object complexObject = jpaComplexObjectMap.get(propertyName);
- parse2JPAEntityValueMap(complexObject, ((EdmComplexType) property.getType()),
- (Map<String, Object>) propertyValue, propertyName);
+ parse2JPAEntityValueMap(complexObject, ((EdmComplexType) property.getType()), (Map<String, Object>) propertyValue, propertyName);
setters.get(key).invoke(jpaEntity, complexObject);
} else {
setters.get(key).invoke(jpaEntity, propertyValue);
@@ -195,57 +175,40 @@ public class JPACreateRequest extends JPAWriteRequest {
Class<?> propertyClass = null;
try {
- for (EntityType<?> entity : metamodel.getEntities())
- {
- if (entity.getName().equals(entityName))
- {
+ for (EntityType<?> entity : metamodel.getEntities()) {
+ if (entity.getName().equals(entityName)) {
Attribute<?, ?> attribute = entity.getAttribute(nameParts[0].substring(3, 4).toLowerCase() + nameParts[0].substring(4));
propertyClass = attribute.getJavaType();
if (embeddableKeyObj == null) {
try {
embeddableKeyObj = propertyClass.newInstance();
} catch (InstantiationException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
}
break;
}
}
- method = propertyValue.getClass().getMethod(
- nameParts[0], propertyClass);
+ method = propertyValue.getClass().getMethod(nameParts[0], propertyClass);
populateEmbeddableKey(embeddableKeyObj, embeddableKey, nameParts[1], propertyValueMap);
} catch (NoSuchMethodException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
}
propertyName = "Embeddable Key";//$NON-NLS-1$
method.invoke(jpaEntity, embeddableKeyObj);
}
} catch (SecurityException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (EdmException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (IllegalAccessException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (IllegalArgumentException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.ERROR_JPQL_PARAM_VALUE
- .addContent(propertyName), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.ERROR_JPQL_PARAM_VALUE.addContent(propertyName), e);
} catch (InvocationTargetException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
return jpaEntity;
}
@@ -256,28 +219,18 @@ public class JPACreateRequest extends JPAWriteRequest {
try {
method = embeddableKeyObject.getClass().getMethod(setterName, propertyClass);
} catch (NoSuchMethodException e1) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e1.getMessage()), e1);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e1.getMessage()), e1);
} catch (SecurityException e1) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e1.getMessage()), e1);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e1.getMessage()), e1);
}
try {
method.invoke(embeddableKeyObject, propertyValueMap.get(key));
} catch (IllegalAccessException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (IllegalArgumentException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.ERROR_JPQL_KEY_VALUE
- .addContent(key), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.ERROR_JPQL_KEY_VALUE.addContent(key), e);
} catch (InvocationTargetException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
}
@@ -305,16 +258,13 @@ public class JPACreateRequest extends JPAWriteRequest {
String entityName = null;
EdmEntityType relatedEntityType = relatedEntitySet.getEntityType();
try {
- if (relatedEntityType.getMapping() != null && relatedEntityType.getMapping().getInternalName() != null)
- {
+ if (relatedEntityType.getMapping() != null && relatedEntityType.getMapping().getInternalName() != null) {
entityName = relatedEntityType.getMapping().getInternalName();
} else {
entityName = relatedEntityType.getName();
}
} catch (EdmException e1) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e1.getMessage()), e1);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e1.getMessage()), e1);
}
Object relatedData = null;
@@ -328,13 +278,9 @@ public class JPACreateRequest extends JPAWriteRequest {
relatedData = entityTypeTemp.getJavaType().newInstance();
break;
} catch (InstantiationException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (IllegalAccessException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
}
}
@@ -357,8 +303,7 @@ public class JPACreateRequest extends JPAWriteRequest {
}
@SuppressWarnings("unchecked")
- private void setNavigationProperties(
- final Object jpaEntity, final EdmEntitySet entitySet, final Map<String, Object> propertyValueMap, final String entityName, final Map<String, Class<?>> relatedClassMap) throws ODataJPARuntimeException {
+ private void setNavigationProperties(final Object jpaEntity, final EdmEntitySet entitySet, final Map<String, Object> propertyValueMap, final String entityName, final Map<String, Class<?>> relatedClassMap) throws ODataJPARuntimeException {
if (jpaEntity == null || entitySet == null || propertyValueMap == null || propertyValueMap.size() == 0) {
return;
}
@@ -378,17 +323,11 @@ public class JPACreateRequest extends JPAWriteRequest {
method.invoke(jpaEntity, propertyValue.get(0));
}
} catch (IllegalAccessException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (IllegalArgumentException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (InvocationTargetException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
}
@@ -402,9 +341,7 @@ public class JPACreateRequest extends JPAWriteRequest {
try {
edmEntityType = edmEntitySet.getEntityType();
} catch (EdmException e2) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e2.getMessage()), e2);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e2.getMessage()), e2);
}
try {
@@ -412,16 +349,13 @@ public class JPACreateRequest extends JPAWriteRequest {
final EdmNavigationProperty navigationProperty = (EdmNavigationProperty) edmEntityType.getProperty(navigationPropertyName);
String entityName = null;
try {
- if (navigationProperty.getMapping() != null && navigationProperty.getMapping().getInternalName() != null)
- {
+ if (navigationProperty.getMapping() != null && navigationProperty.getMapping().getInternalName() != null) {
entityName = navigationProperty.getMapping().getInternalName();
} else {
entityName = navigationProperty.getName();
}
} catch (EdmException e1) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e1.getMessage()), e1);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e1.getMessage()), e1);
}
String name = getSetterName(entityName);
@@ -437,31 +371,22 @@ public class JPACreateRequest extends JPAWriteRequest {
multiplicityMap.put(entityName, EdmMultiplicity.ONE);
}
try {
- setters.put(
- entityName,
- jpaEntity.getClass().getDeclaredMethod(name, propertyClass));
+ setters.put(entityName, jpaEntity.getClass().getDeclaredMethod(name, propertyClass));
} catch (NoSuchMethodException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (SecurityException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
}
} catch (EdmException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
mapList.add(0, setters);
mapList.add(1, multiplicityMap);
return mapList;
}
- private String getSetterName(final String navigationPropertyName)
- throws ODataJPARuntimeException {
+ private String getSetterName(final String navigationPropertyName) throws ODataJPARuntimeException {
StringBuilder builder = new StringBuilder();
char c = Character.toUpperCase(navigationPropertyName.charAt(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/cud/JPALink.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/cud/JPALink.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/cud/JPALink.java
index c1a3e8c..91fa53a 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/cud/JPALink.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/cud/JPALink.java
@@ -52,8 +52,7 @@ public class JPALink {
public JPALink(final ODataJPAContext context) {
this.context = context;
- jpaProcessor = ODataJPAFactory.createFactory().getJPAAccessFactory()
- .getJPAProcessor(this.context);
+ jpaProcessor = ODataJPAFactory.createFactory().getJPAAccessFactory().getJPAProcessor(this.context);
parser = new ODataEntityParser(this.context);
}
@@ -61,8 +60,7 @@ public class JPALink {
sourceJPAEntity = jpaEntity;
}
- public void create(final PostUriInfo uriInfo, final InputStream content, final String requestContentType, final String contentType)
- throws ODataJPARuntimeException, ODataJPAModelException {
+ public void create(final PostUriInfo uriInfo, final InputStream content, final String requestContentType, final String contentType) throws ODataJPARuntimeException, ODataJPAModelException {
EdmEntitySet targetEntitySet = uriInfo.getTargetEntitySet();
String targerEntitySetName;
@@ -70,9 +68,7 @@ public class JPALink {
try {
targerEntitySetName = targetEntitySet.getName();
} catch (EdmException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
List<UriInfo> uriInfoList = new ArrayList<UriInfo>();
@@ -82,9 +78,7 @@ public class JPALink {
uriInfoList = new ArrayList<UriInfo>();
uriInfoList.add(getUriInfo);
navigationProperty = uriInfo.getNavigationSegments().get(0).getNavigationProperty();
- }
- else
- {
+ } else {
uriInfoList = parser.parseLinks(targetEntitySet, content, contentType);
}
@@ -94,10 +88,8 @@ public class JPALink {
try {
for (UriInfo getUriInfo : uriInfoList) {
- if (!getUriInfo.getTargetEntitySet().getName().equals(targerEntitySetName))
- {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.RELATIONSHIP_INVALID, null);
+ if (!getUriInfo.getTargetEntitySet().getName().equals(targerEntitySetName)) {
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RELATIONSHIP_INVALID, null);
}
if (!((UriInfo) uriInfo).isLinks()) {
navigationProperty = getUriInfo.getNavigationSegments().get(0).getNavigationProperty();
@@ -108,18 +100,14 @@ public class JPALink {
getUriInfo = parser.parseLinkURI();
sourceJPAEntity = jpaProcessor.process((GetEntityUriInfo) getUriInfo);
if (sourceJPAEntity == null) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.RESOURCE_X_NOT_FOUND.
- addContent(getUriInfo.getTargetEntitySet().getName()), null);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RESOURCE_X_NOT_FOUND.addContent(getUriInfo.getTargetEntitySet().getName()), null);
}
}
JPAEntityParser entityParser = JPAEntityParser.create();
- Method setMethod = entityParser.getAccessModifier(sourceJPAEntity,
- navigationProperty, JPAEntityParser.ACCESS_MODIFIER_SET);
+ Method setMethod = entityParser.getAccessModifier(sourceJPAEntity, navigationProperty, JPAEntityParser.ACCESS_MODIFIER_SET);
- Method getMethod = entityParser.getAccessModifier(sourceJPAEntity,
- navigationProperty, JPAEntityParser.ACCESS_MODIFIER_GET);
+ Method getMethod = entityParser.getAccessModifier(sourceJPAEntity, navigationProperty, JPAEntityParser.ACCESS_MODIFIER_GET);
if (getMethod.getReturnType().getTypeParameters() != null) {
@SuppressWarnings("unchecked")
@@ -131,21 +119,13 @@ public class JPALink {
}
}
} catch (IllegalAccessException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (IllegalArgumentException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (InvocationTargetException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (EdmException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
}
@@ -163,8 +143,7 @@ public class JPALink {
}
- public void update(final PutMergePatchUriInfo putUriInfo, final InputStream content,
- final String requestContentType, final String contentType) throws ODataJPARuntimeException, ODataJPAModelException {
+ public void update(final PutMergePatchUriInfo putUriInfo, final InputStream content, final String requestContentType, final String contentType) throws ODataJPARuntimeException, ODataJPAModelException {
UriInfo uriInfo = (UriInfo) putUriInfo;
EdmEntitySet targetEntitySet = uriInfo.getTargetEntitySet();
@@ -173,9 +152,7 @@ public class JPALink {
try {
targerEntitySetName = targetEntitySet.getName();
} catch (EdmException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
List<UriInfo> uriInfoList = new ArrayList<UriInfo>();
@@ -185,9 +162,7 @@ public class JPALink {
uriInfoList = new ArrayList<UriInfo>();
uriInfoList.add(getUriInfo);
navigationProperty = uriInfo.getNavigationSegments().get(0).getNavigationProperty();
- }
- else
- {
+ } else {
uriInfoList = parser.parseLinks(targetEntitySet, content, contentType);
}
@@ -197,10 +172,8 @@ public class JPALink {
try {
for (UriInfo getUriInfo : uriInfoList) {
- if (!getUriInfo.getTargetEntitySet().getName().equals(targerEntitySetName))
- {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.RELATIONSHIP_INVALID, null);
+ if (!getUriInfo.getTargetEntitySet().getName().equals(targerEntitySetName)) {
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RELATIONSHIP_INVALID, null);
}
if (!((UriInfo) uriInfo).isLinks()) {
navigationProperty = getUriInfo.getNavigationSegments().get(0).getNavigationProperty();
@@ -211,18 +184,14 @@ public class JPALink {
getUriInfo = parser.parseLinkURI();
sourceJPAEntity = jpaProcessor.process((GetEntityUriInfo) getUriInfo);
if (sourceJPAEntity == null) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.RESOURCE_X_NOT_FOUND.
- addContent(getUriInfo.getTargetEntitySet().getName()), null);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.RESOURCE_X_NOT_FOUND.addContent(getUriInfo.getTargetEntitySet().getName()), null);
}
}
JPAEntityParser entityParser = JPAEntityParser.create();
- Method setMethod = entityParser.getAccessModifier(sourceJPAEntity,
- navigationProperty, JPAEntityParser.ACCESS_MODIFIER_SET);
+ Method setMethod = entityParser.getAccessModifier(sourceJPAEntity, navigationProperty, JPAEntityParser.ACCESS_MODIFIER_SET);
- Method getMethod = entityParser.getAccessModifier(sourceJPAEntity,
- navigationProperty, JPAEntityParser.ACCESS_MODIFIER_GET);
+ Method getMethod = entityParser.getAccessModifier(sourceJPAEntity, navigationProperty, JPAEntityParser.ACCESS_MODIFIER_GET);
if (getMethod.getReturnType().getTypeParameters() != null && getMethod.getReturnType().getTypeParameters().length != 0) {
@SuppressWarnings("unchecked")
@@ -234,21 +203,13 @@ public class JPALink {
}
}
} catch (IllegalAccessException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (IllegalArgumentException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (InvocationTargetException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} 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/cud/JPAUpdateRequest.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/cud/JPAUpdateRequest.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/cud/JPAUpdateRequest.java
index b8ae487..5781a96 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/cud/JPAUpdateRequest.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/cud/JPAUpdateRequest.java
@@ -50,33 +50,25 @@ public class JPAUpdateRequest extends JPAWriteRequest {
try {
entityType = entitySet.getEntityType();
} catch (EdmException e3) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e3.getMessage()), e3);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e3.getMessage()), e3);
}
ODataEntry entryValues = null;
try {
entryValues = parseEntry(entitySet, content, requestContentType, false);
} catch (ODataBadRequestException e1) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e1.getMessage()), e1);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e1.getMessage()), e1);
}
try {
Map<String, Object> propertValueMap = entryValues.getProperties();
parse2JPAEntityValueMap(jpaEntity, entityType, propertValueMap);
} catch (ODataJPARuntimeException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
}
@SuppressWarnings("unchecked")
- public final Object parse2JPAEntityValueMap(
- final Object jpaEntity, final EdmStructuralType edmEntityType, final Map<String, Object> propertyValueMap)
- throws ODataJPARuntimeException {
+ public final Object parse2JPAEntityValueMap(final Object jpaEntity, final EdmStructuralType edmEntityType, final Map<String, Object> propertyValueMap) throws ODataJPARuntimeException {
if (jpaEntity == null || edmEntityType == null || propertyValueMap == null) {
return null;
@@ -85,20 +77,16 @@ public class JPAUpdateRequest extends JPAWriteRequest {
String jpaEntityAccessKey = jpaEntity.getClass().getName();
if (!jpaEntityAccessMap.containsKey(jpaEntityAccessKey)) {
- jpaEntityAccessMap.put(jpaEntityAccessKey,
- getSetters(jpaEntity, edmEntityType, false));
+ jpaEntityAccessMap.put(jpaEntityAccessKey, getSetters(jpaEntity, edmEntityType, false));
}
- HashMap<String, Method> setters = jpaEntityAccessMap
- .get(jpaEntityAccessKey);
+ HashMap<String, Method> setters = jpaEntityAccessMap.get(jpaEntityAccessKey);
List<EdmProperty> keyProperties = null;
if (edmEntityType instanceof EdmEntityType) {
try {
keyProperties = ((EdmEntityType) edmEntityType).getKeyProperties();
} catch (EdmException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
}
boolean isKeyProperty = false;
@@ -117,8 +105,7 @@ public class JPAUpdateRequest extends JPAWriteRequest {
continue;
}
}
- EdmProperty property = (EdmProperty) edmEntityType
- .getProperty(key);
+ EdmProperty property = (EdmProperty) edmEntityType.getProperty(key);
if (property.getMapping() != null && property.getMapping().getInternalName() != null) {
propertyName = property.getMapping().getInternalName();
} else {
@@ -137,8 +124,7 @@ public class JPAUpdateRequest extends JPAWriteRequest {
if (method != null) {
if (property.getType().getKind().equals(EdmTypeKind.COMPLEX)) {
Object complexObject = jpaComplexObjectMap.get(propertyName);
- parse2JPAEntityValueMap(complexObject, ((EdmComplexType) property.getType()),
- (Map<String, Object>) propertyValue);
+ parse2JPAEntityValueMap(complexObject, ((EdmComplexType) property.getType()), (Map<String, Object>) propertyValue);
setters.get(key).invoke(jpaEntity, complexObject);
} else {
setters.get(key).invoke(jpaEntity, propertyValue);
@@ -148,25 +134,15 @@ public class JPAUpdateRequest extends JPAWriteRequest {
}
} catch (SecurityException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (EdmException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (IllegalAccessException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (IllegalArgumentException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.ERROR_JPQL_PARAM_VALUE
- .addContent(propertyName), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.ERROR_JPQL_PARAM_VALUE.addContent(propertyName), e);
} catch (InvocationTargetException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
return jpaEntity;
}
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/cud/JPAWriteRequest.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/cud/JPAWriteRequest.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/cud/JPAWriteRequest.java
index d8fd6d4..dc8e592 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/cud/JPAWriteRequest.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/cud/JPAWriteRequest.java
@@ -49,16 +49,14 @@ public class JPAWriteRequest {
jpaComplexObjectMap = new HashMap<String, Object>();
}
- protected HashMap<String, Method> getSetters(final Object jpaEntity,
- final EdmStructuralType structuralType, final boolean isCreate) throws ODataJPARuntimeException {
+ protected HashMap<String, Method> getSetters(final Object jpaEntity, final EdmStructuralType structuralType, final boolean isCreate) throws ODataJPARuntimeException {
HashMap<String, Method> setters = new HashMap<String, Method>();
HashMap<String, String> embeddableKey = new HashMap<String, String>();
try {
for (String propertyName : structuralType.getPropertyNames()) {
- EdmProperty property = (EdmProperty) structuralType
- .getProperty(propertyName);
+ EdmProperty property = (EdmProperty) structuralType.getProperty(propertyName);
Class<?> propertyClass = null;
try {
if (property.getMapping() != null && ((JPAEdmMappingImpl) property.getMapping()).getJPAType() != null) {
@@ -71,22 +69,16 @@ public class JPAWriteRequest {
jpaComplexObjectMap.put(propertyName, propertyClass.newInstance());
}
} catch (InstantiationException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (IllegalAccessException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
}
} else {
propertyClass = EdmTypeConvertor.convertToJavaType(property.getType());
}
} catch (ODataJPAModelException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
String name = getSetterName(property);
String[] nameParts = name.split("\\.");
@@ -96,34 +88,24 @@ public class JPAWriteRequest {
embeddableKey.put(propertyName, name);
}
} else {
- setters.put(
- propertyName,
- jpaEntity.getClass().getMethod(name, propertyClass));
+ setters.put(propertyName, jpaEntity.getClass().getMethod(name, propertyClass));
}
}
} catch (NoSuchMethodException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (SecurityException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
} catch (EdmException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
if (isCreate && !embeddableKey.isEmpty()) {
- jpaEmbeddableKeyMap.put(jpaEntity.getClass().getName(),
- embeddableKey);
+ jpaEmbeddableKeyMap.put(jpaEntity.getClass().getName(), embeddableKey);
}
return setters;
}
- private String getSetterName(final EdmProperty property)
- throws ODataJPARuntimeException {
+ private String getSetterName(final EdmProperty property) throws ODataJPARuntimeException {
EdmMapping mapping = null;
String name = null;
try {
@@ -135,9 +117,7 @@ public class JPAWriteRequest {
}
} catch (EdmException e) {
- throw ODataJPARuntimeException
- .throwException(ODataJPARuntimeException.GENERAL
- .addContent(e.getMessage()), e);
+ throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
String[] nameParts = name.split("\\."); //$NON-NLS-1$
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/edm/ODataJPAEdmProvider.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/edm/ODataJPAEdmProvider.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/edm/ODataJPAEdmProvider.java
index edc3da9..ecce1ad 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/edm/ODataJPAEdmProvider.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/edm/ODataJPAEdmProvider.java
@@ -63,16 +63,14 @@ public class ODataJPAEdmProvider extends EdmProvider {
public ODataJPAEdmProvider(final ODataJPAContext oDataJPAContext) {
if (oDataJPAContext == null) {
- throw new IllegalArgumentException(
- ODataJPAException.ODATA_JPACTX_NULL);
+ throw new IllegalArgumentException(ODataJPAException.ODATA_JPACTX_NULL);
}
entityTypes = new HashMap<String, EntityType>();
entityContainerInfos = new HashMap<String, EntityContainerInfo>();
complexTypes = new HashMap<String, ComplexType>();
associations = new HashMap<String, Association>();
functionImports = new HashMap<String, FunctionImport>();
- jpaEdmModel = ODataJPAFactory.createFactory().getJPAAccessFactory()
- .getJPAEdmModelView(oDataJPAContext);
+ jpaEdmModel = ODataJPAFactory.createFactory().getJPAAccessFactory().getJPAEdmModelView(oDataJPAContext);
}
public ODataJPAContext getODataJPAContext() {
@@ -84,8 +82,7 @@ public class ODataJPAEdmProvider extends EdmProvider {
}
@Override
- public EntityContainerInfo getEntityContainerInfo(final String name)
- throws ODataException {
+ public EntityContainerInfo getEntityContainerInfo(final String name) throws ODataException {
if (entityContainerInfos.containsKey(name)) {
return entityContainerInfos.get(name);
@@ -95,7 +92,9 @@ public class ODataJPAEdmProvider extends EdmProvider {
getSchemas();
}
List<EntityContainer> containerList = schemas.get(0).getEntityContainers();
- if (containerList == null) return null;
+ if (containerList == null) {
+ return null;
+ }
for (EntityContainer container : containerList) {
if (name == null && container.isDefaultEntityContainer()) {
entityContainerInfos.put(name, container);
@@ -109,8 +108,7 @@ public class ODataJPAEdmProvider extends EdmProvider {
}
@Override
- public EntityType getEntityType(final FullQualifiedName edmFQName)
- throws ODataException {
+ public EntityType getEntityType(final FullQualifiedName edmFQName) throws ODataException {
String strEdmFQName = edmFQName.toString();
@@ -127,7 +125,9 @@ public class ODataJPAEdmProvider extends EdmProvider {
for (Schema schema : schemas) {
String schemaNamespace = schema.getNamespace();
if (schemaNamespace.equals(entityTypeNamespace)) {
- if (schema.getEntityTypes() == null) return null;
+ if (schema.getEntityTypes() == null) {
+ return null;
+ }
for (EntityType et : schema.getEntityTypes()) {
if (et.getName().equals(entityTypeName)) {
entityTypes.put(strEdmFQName, et);
@@ -142,8 +142,7 @@ public class ODataJPAEdmProvider extends EdmProvider {
}
@Override
- public ComplexType getComplexType(final FullQualifiedName edmFQName)
- throws ODataException {
+ public ComplexType getComplexType(final FullQualifiedName edmFQName) throws ODataException {
if (edmFQName != null) {
if (complexTypes.containsKey(edmFQName.toString())) {
@@ -154,7 +153,9 @@ public class ODataJPAEdmProvider extends EdmProvider {
for (Schema schema : schemas) {
if (schema.getNamespace().equals(edmFQName.getNamespace())) {
- if (schema.getComplexTypes() == null) return null;
+ if (schema.getComplexTypes() == null) {
+ return null;
+ }
for (ComplexType ct : schema.getComplexTypes()) {
if (ct.getName().equals(edmFQName.getName())) {
complexTypes.put(edmFQName.toString(), ct);
@@ -169,8 +170,7 @@ public class ODataJPAEdmProvider extends EdmProvider {
}
@Override
- public Association getAssociation(final FullQualifiedName edmFQName)
- throws ODataException {
+ public Association getAssociation(final FullQualifiedName edmFQName) throws ODataException {
if (edmFQName != null) {
if (associations.containsKey(edmFQName.toString())) {
return associations.get(edmFQName.toString());
@@ -180,12 +180,12 @@ public class ODataJPAEdmProvider extends EdmProvider {
for (Schema schema : schemas) {
if (schema.getNamespace().equals(edmFQName.getNamespace())) {
- if (schema.getAssociations() == null) return null;
+ if (schema.getAssociations() == null) {
+ return null;
+ }
for (Association association : schema.getAssociations()) {
- if (association.getName().equals(
- edmFQName.getName())) {
- associations.put(edmFQName.toString(),
- association);
+ if (association.getName().equals(edmFQName.getName())) {
+ associations.put(edmFQName.toString(), association);
return association;
}
}
@@ -197,16 +197,14 @@ public class ODataJPAEdmProvider extends EdmProvider {
}
@Override
- public EntitySet getEntitySet(final String entityContainer, final String name)
- throws ODataException {
+ public EntitySet getEntitySet(final String entityContainer, final String name) throws ODataException {
EntitySet returnedSet = null;
EntityContainer container = null;
if (!entityContainerInfos.containsKey(entityContainer)) {
container = (EntityContainer) getEntityContainerInfo(entityContainer);
} else {
- container = (EntityContainer) entityContainerInfos
- .get(entityContainer);
+ container = (EntityContainer) entityContainerInfos.get(entityContainer);
}
if (container != null && name != null) {
@@ -222,29 +220,24 @@ public class ODataJPAEdmProvider extends EdmProvider {
}
@Override
- public AssociationSet getAssociationSet(final String entityContainer,
- final FullQualifiedName association, final String sourceEntitySetName,
- final String sourceEntitySetRole) throws ODataException {
+ public AssociationSet getAssociationSet(final String entityContainer, final FullQualifiedName association, final String sourceEntitySetName, final String sourceEntitySetRole) throws ODataException {
EntityContainer container = null;
if (!entityContainerInfos.containsKey(entityContainer)) {
container = (EntityContainer) getEntityContainerInfo(entityContainer);
} else {
- container = (EntityContainer) entityContainerInfos
- .get(entityContainer);
+ container = (EntityContainer) entityContainerInfos.get(entityContainer);
}
if (container != null && association != null && container.getAssociationSets() != null) {
for (AssociationSet as : container.getAssociationSets()) {
if (association.equals(as.getAssociation())) {
AssociationSetEnd end = as.getEnd1();
- if (sourceEntitySetName.equals(end.getEntitySet())
- && sourceEntitySetRole.equals(end.getRole())) {
+ if (sourceEntitySetName.equals(end.getEntitySet()) && sourceEntitySetRole.equals(end.getRole())) {
return as;
} else {
end = as.getEnd2();
- if (sourceEntitySetName.equals(end.getEntitySet())
- && sourceEntitySetRole.equals(end.getRole())) {
+ if (sourceEntitySetName.equals(end.getEntitySet()) && sourceEntitySetRole.equals(end.getRole())) {
return as;
}
}
@@ -255,8 +248,7 @@ public class ODataJPAEdmProvider extends EdmProvider {
}
@Override
- public FunctionImport getFunctionImport(final String entityContainer, final String name)
- throws ODataException {
+ public FunctionImport getFunctionImport(final String entityContainer, final String name) throws ODataException {
if (functionImports.containsKey(name)) {
return functionImports.get(name);
@@ -266,12 +258,13 @@ public class ODataJPAEdmProvider extends EdmProvider {
if (!entityContainerInfos.containsKey(entityContainer)) {
container = (EntityContainer) getEntityContainerInfo(entityContainer);
} else {
- container = (EntityContainer) entityContainerInfos
- .get(entityContainer);
+ container = (EntityContainer) entityContainerInfos.get(entityContainer);
}
if (container != null && name != null) {
- if (container.getFunctionImports() == null) return null;
+ if (container.getFunctionImports() == null) {
+ return null;
+ }
for (FunctionImport fi : container.getFunctionImports()) {
if (name.equals(fi.getName())) {
functionImports.put(name, fi);
@@ -291,8 +284,7 @@ public class ODataJPAEdmProvider extends EdmProvider {
}
if (jpaEdmModel == null) {
- throw ODataJPAModelException.throwException(
- ODataJPAModelException.BUILDER_NULL, null);
+ throw ODataJPAModelException.throwException(ODataJPAModelException.BUILDER_NULL, null);
}
return schemas;
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/exception/ODataJPAMessageServiceDefault.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/exception/ODataJPAMessageServiceDefault.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/exception/ODataJPAMessageServiceDefault.java
index 2039efc..72118da 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/exception/ODataJPAMessageServiceDefault.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/exception/ODataJPAMessageServiceDefault.java
@@ -70,14 +70,11 @@ public class ODataJPAMessageServiceDefault implements ODataJPAMessageService {
} catch (MissingResourceException e) {
return "Missing message for key '" + key + "'!";
} catch (MissingFormatArgumentException e) {
- return "Missing replacement for place holder in value '" + value
- + "' for following arguments '"
- + Arrays.toString(contentAsArray) + "'!";
+ return "Missing replacement for place holder in value '" + value + "' for following arguments '" + Arrays.toString(contentAsArray) + "'!";
}
}
- private ODataJPAMessageServiceDefault(final ResourceBundle resourceBundle,
- final Locale locale) {
+ private ODataJPAMessageServiceDefault(final ResourceBundle resourceBundle, final Locale locale) {
this.resourceBundle = resourceBundle;
lanLocale = locale;
}
@@ -101,18 +98,15 @@ public class ODataJPAMessageServiceDefault implements ODataJPAMessageService {
}
}
- ODataJPAMessageService messagesInstance = LOCALE_2_MESSAGE_SERVICE
- .get(acceptedLocale);
+ ODataJPAMessageService messagesInstance = LOCALE_2_MESSAGE_SERVICE.get(acceptedLocale);
if (messagesInstance == null) {
ResourceBundle resourceBundle = ResourceBundle.getBundle(BUNDLE_NAME, acceptedLocale);
if (resourceBundle != null) {
- messagesInstance = new ODataJPAMessageServiceDefault(
- resourceBundle, acceptedLocale);
+ messagesInstance = new ODataJPAMessageServiceDefault(resourceBundle, acceptedLocale);
LOCALE_2_MESSAGE_SERVICE.put(acceptedLocale, messagesInstance);
} else if (defaultResourceBundle != null) {
- messagesInstance = new ODataJPAMessageServiceDefault(
- defaultResourceBundle, null);
+ messagesInstance = new ODataJPAMessageServiceDefault(defaultResourceBundle, 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/factory/ODataJPAFactoryImpl.java
----------------------------------------------------------------------
diff --git a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/factory/ODataJPAFactoryImpl.java b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/factory/ODataJPAFactoryImpl.java
index ca843a9..2f6da6e 100644
--- a/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/factory/ODataJPAFactoryImpl.java
+++ b/jpa-core/src/main/java/org/apache/olingo/odata2/processor/core/jpa/factory/ODataJPAFactoryImpl.java
@@ -114,8 +114,7 @@ public class ODataJPAFactoryImpl extends ODataJPAFactory {
contextBuilder = singleSelectContext.new JPQLSelectSingleContextBuilder();
break;
case JOIN:
- JPQLJoinSelectContext joinContext = new JPQLJoinSelectContext(
- false);
+ JPQLJoinSelectContext joinContext = new JPQLJoinSelectContext(false);
contextBuilder = joinContext.new JPQLJoinContextBuilder();
break;
case JOIN_SINGLE:
@@ -123,13 +122,11 @@ public class ODataJPAFactoryImpl extends ODataJPAFactory {
contextBuilder = joinSingleContext.new JPQLJoinSelectSingleContextBuilder();
break;
case SELECT_COUNT:
- JPQLSelectContext selectCountContext = new JPQLSelectContext(
- true);
+ JPQLSelectContext selectCountContext = new JPQLSelectContext(true);
contextBuilder = selectCountContext.new JPQLSelectContextBuilder();
break;
case JOIN_COUNT:
- JPQLJoinSelectContext joinCountContext = new JPQLJoinSelectContext(
- true);
+ JPQLJoinSelectContext joinCountContext = new JPQLJoinSelectContext(true);
contextBuilder = joinCountContext.new JPQLJoinContextBuilder();
default:
break;
@@ -147,8 +144,7 @@ public class ODataJPAFactoryImpl extends ODataJPAFactory {
}
@Override
- public JPAMethodContextBuilder getJPAMethodContextBuilder(
- final JPQLContextType contextType) {
+ public JPAMethodContextBuilder getJPAMethodContextBuilder(final JPQLContextType contextType) {
JPAMethodContextBuilder contextBuilder = null;
switch (contextType) {
@@ -165,16 +161,14 @@ public class ODataJPAFactoryImpl extends ODataJPAFactory {
}
- private static class ODataJPAAccessFactoryImpl implements
- ODataJPAAccessFactory {
+ private static class ODataJPAAccessFactoryImpl implements ODataJPAAccessFactory {
private static ODataJPAAccessFactoryImpl factory = null;
private ODataJPAAccessFactoryImpl() {}
@Override
- public ODataSingleProcessor createODataProcessor(
- final ODataJPAContext oDataJPAContext) {
+ public ODataSingleProcessor createODataProcessor(final ODataJPAContext oDataJPAContext) {
return new ODataJPAProcessorDefault(oDataJPAContext);
}
@@ -210,8 +204,7 @@ public class ODataJPAFactoryImpl extends ODataJPAFactory {
private JPAAccessFactoryImpl() {}
@Override
- public JPAEdmModelView getJPAEdmModelView(
- final ODataJPAContext oDataJPAContext) {
+ public JPAEdmModelView getJPAEdmModelView(final ODataJPAContext oDataJPAContext) {
JPAEdmModelView view = null;
view = new JPAEdmModel(oDataJPAContext);
@@ -234,10 +227,8 @@ public class ODataJPAFactoryImpl extends ODataJPAFactory {
}
@Override
- public JPAEdmMappingModelAccess getJPAEdmMappingModelAccess(
- final ODataJPAContext oDataJPAContext) {
- JPAEdmMappingModelAccess mappingModelAccess = new JPAEdmMappingModelService(
- oDataJPAContext);
+ public JPAEdmMappingModelAccess getJPAEdmMappingModelAccess(final ODataJPAContext oDataJPAContext) {
+ JPAEdmMappingModelAccess mappingModelAccess = new JPAEdmMappingModelService(oDataJPAContext);
return mappingModelAccess;
}