You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2013/09/20 15:33:54 UTC
[32/59] [abbrv] Cleanup of core
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityComplexPropertyInfo.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityComplexPropertyInfo.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityComplexPropertyInfo.java
index 5a4303f..01d78da 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityComplexPropertyInfo.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityComplexPropertyInfo.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.ep.aggregator;
@@ -36,12 +36,14 @@ public class EntityComplexPropertyInfo extends EntityPropertyInfo {
protected List<EntityPropertyInfo> entityPropertyInfo;
- EntityComplexPropertyInfo(final String name, final EdmType type, final EdmFacets facets, final EdmCustomizableFeedMappings customizableFeedMapping, final List<EntityPropertyInfo> childEntityInfos) {
+ EntityComplexPropertyInfo(final String name, final EdmType type, final EdmFacets facets,
+ final EdmCustomizableFeedMappings customizableFeedMapping, final List<EntityPropertyInfo> childEntityInfos) {
super(name, type, facets, customizableFeedMapping, null, null);
entityPropertyInfo = childEntityInfos;
}
- static EntityComplexPropertyInfo create(final EdmProperty property, final List<String> propertyNames, final Map<String, EntityPropertyInfo> childEntityInfos) throws EdmException {
+ static EntityComplexPropertyInfo create(final EdmProperty property, final List<String> propertyNames,
+ final Map<String, EntityPropertyInfo> childEntityInfos) throws EdmException {
List<EntityPropertyInfo> childEntityInfoList = new ArrayList<EntityPropertyInfo>(childEntityInfos.size());
for (String name : propertyNames) {
childEntityInfoList.add(childEntityInfos.get(name));
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityInfoAggregator.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityInfoAggregator.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityInfoAggregator.java
index 566faba..9345c7e 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityInfoAggregator.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityInfoAggregator.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.ep.aggregator;
@@ -46,9 +46,10 @@ import org.apache.olingo.odata2.api.ep.EntityProviderException;
import org.apache.olingo.odata2.api.uri.ExpandSelectTreeNode;
/**
- * Aggregator to get easy and fast access to all for serialization and de-serialization necessary {@link EdmEntitySet} informations.
+ * Aggregator to get easy and fast access to all for serialization and de-serialization necessary {@link EdmEntitySet}
+ * informations.
+ *
*
- *
*/
public class EntityInfoAggregator {
@@ -100,15 +101,16 @@ public class EntityInfoAggregator {
* Create an {@link EntityInfoAggregator} based on given {@link EdmEntitySet}
*
* @param entitySet
- * with which the {@link EntityInfoAggregator} is initialized.
- * @param expandSelectTree
+ * with which the {@link EntityInfoAggregator} is initialized.
+ * @param expandSelectTree
* @return created and initialized {@link EntityInfoAggregator}
* @throws EntityProviderException
- * if during initialization of {@link EntityInfoAggregator} something goes wrong (e.g. exceptions during
- * access
- * of {@link EdmEntitySet}).
+ * if during initialization of {@link EntityInfoAggregator} something goes wrong (e.g. exceptions during
+ * access
+ * of {@link EdmEntitySet}).
*/
- public static EntityInfoAggregator create(final EdmEntitySet entitySet, final ExpandSelectTreeNode expandSelectTree) throws EntityProviderException {
+ public static EntityInfoAggregator create(final EdmEntitySet entitySet, final ExpandSelectTreeNode expandSelectTree)
+ throws EntityProviderException {
EntityInfoAggregator eia = new EntityInfoAggregator();
eia.initialize(entitySet, expandSelectTree);
return eia;
@@ -118,12 +120,12 @@ public class EntityInfoAggregator {
* Create an {@link EntityInfoAggregator} based on given {@link EdmEntitySet}
*
* @param entitySet
- * with which the {@link EntityInfoAggregator} is initialized.
+ * with which the {@link EntityInfoAggregator} is initialized.
* @return created and initialized {@link EntityInfoAggregator}
* @throws EntityProviderException
- * if during initialization of {@link EntityInfoAggregator} something goes wrong (e.g. exceptions during
- * access
- * of {@link EdmEntitySet}).
+ * if during initialization of {@link EntityInfoAggregator} something goes wrong (e.g. exceptions during
+ * access
+ * of {@link EdmEntitySet}).
*/
public static EntityInfoAggregator create(final EdmEntitySet entitySet) throws EntityProviderException {
EntityInfoAggregator eia = new EntityInfoAggregator();
@@ -135,11 +137,11 @@ public class EntityInfoAggregator {
* Create an {@link EntityPropertyInfo} based on given {@link EdmProperty}
*
* @param property
- * for which the {@link EntityPropertyInfo} is created.
+ * for which the {@link EntityPropertyInfo} is created.
* @return created {@link EntityPropertyInfo}
* @throws EntityProviderException
- * if create of {@link EntityPropertyInfo} something goes wrong (e.g. exceptions during
- * access of {@link EdmProperty}).
+ * if create of {@link EntityPropertyInfo} something goes wrong (e.g. exceptions during
+ * access of {@link EdmProperty}).
*/
public static EntityPropertyInfo create(final EdmProperty property) throws EntityProviderException {
try {
@@ -151,16 +153,18 @@ public class EntityInfoAggregator {
}
/**
- * Create an map of <code>complex type property name</code> to {@link EntityPropertyInfo} based on given {@link EdmComplexType}
+ * Create an map of <code>complex type property name</code> to {@link EntityPropertyInfo} based on given
+ * {@link EdmComplexType}
*
* @param complexType
- * for which the {@link EntityPropertyInfo} is created.
+ * for which the {@link EntityPropertyInfo} is created.
* @return created map of <code>complex type property name</code> to {@link EntityPropertyInfo}
* @throws EntityProviderException
- * if create of {@link EntityPropertyInfo} something goes wrong (e.g. exceptions during
- * access of {@link EntityPropertyInfo}).
+ * if create of {@link EntityPropertyInfo} something goes wrong (e.g. exceptions during
+ * access of {@link EntityPropertyInfo}).
*/
- public static Map<String, EntityPropertyInfo> create(final EdmComplexType complexType) throws EntityProviderException {
+ public static Map<String, EntityPropertyInfo> create(final EdmComplexType complexType)
+ throws EntityProviderException {
try {
EntityInfoAggregator entityInfo = new EntityInfoAggregator();
return entityInfo.createPropertyInfoObjects(complexType, complexType.getPropertyNames());
@@ -173,11 +177,11 @@ public class EntityInfoAggregator {
* Create an {@link EntityPropertyInfo} based on given {@link EdmFunctionImport}
*
* @param functionImport
- * for which the {@link EntityPropertyInfo} is created.
+ * for which the {@link EntityPropertyInfo} is created.
* @return created {@link EntityPropertyInfo}
* @throws EntityProviderException
- * if create of {@link EntityPropertyInfo} something goes wrong (e.g. exceptions during
- * access of {@link EdmFunctionImport}).
+ * if create of {@link EntityPropertyInfo} something goes wrong (e.g. exceptions during
+ * access of {@link EdmFunctionImport}).
*/
public static EntityPropertyInfo create(final EdmFunctionImport functionImport) throws EntityProviderException {
try {
@@ -204,7 +208,7 @@ public class EntityInfoAggregator {
/**
* @return <code>true</code> if the entity container of {@link EdmEntitySet} is the default container,
- * otherwise <code>false</code>.
+ * otherwise <code>false</code>.
*/
public boolean isDefaultEntityContainer() {
return isDefaultEntityContainer;
@@ -231,7 +235,7 @@ public class EntityInfoAggregator {
/**
* @return unmodifiable set of found <code>none syndication target path names</code> (all target path names which are
- * not pre-defined).
+ * not pre-defined).
*/
public List<String> getNoneSyndicationTargetPathNames() {
return Collections.unmodifiableList(noneSyndicationTargetPaths);
@@ -246,7 +250,7 @@ public class EntityInfoAggregator {
/**
* @return unmodifiable set of all property names.
- */
+ */
public List<String> getPropertyNames() throws EntityProviderException {
return Collections.unmodifiableList(propertyNames);
}
@@ -284,7 +288,7 @@ public class EntityInfoAggregator {
/**
* @return list of all key property infos
- * @throws EntityProviderException
+ * @throws EntityProviderException
*/
public List<EntityPropertyInfo> getKeyPropertyInfos() throws EntityProviderException {
@@ -305,7 +309,8 @@ public class EntityInfoAggregator {
return navigationPropertyInfos.get(name);
}
- private void initialize(final EdmEntitySet entitySet, final ExpandSelectTreeNode expandSelectTree) throws EntityProviderException {
+ private void initialize(final EdmEntitySet entitySet, final ExpandSelectTreeNode expandSelectTree)
+ throws EntityProviderException {
try {
this.entitySet = entitySet;
entityType = entitySet.getEntityType();
@@ -348,7 +353,8 @@ public class EntityInfoAggregator {
}
}
- private Map<String, EntityPropertyInfo> createPropertyInfoObjects(final EdmStructuralType type, final List<String> propertyNames) throws EntityProviderException {
+ private Map<String, EntityPropertyInfo> createPropertyInfoObjects(final EdmStructuralType type,
+ final List<String> propertyNames) throws EntityProviderException {
try {
Map<String, EntityPropertyInfo> infos = new HashMap<String, EntityPropertyInfo>();
@@ -368,7 +374,8 @@ public class EntityInfoAggregator {
}
}
- private Map<String, NavigationPropertyInfo> createNavigationInfoObjects(final EdmStructuralType type, final List<String> propertyNames) throws EntityProviderException {
+ private Map<String, NavigationPropertyInfo> createNavigationInfoObjects(final EdmStructuralType type,
+ final List<String> propertyNames) throws EntityProviderException {
try {
Map<String, NavigationPropertyInfo> infos = new HashMap<String, NavigationPropertyInfo>();
@@ -384,7 +391,8 @@ public class EntityInfoAggregator {
}
}
- private EntityPropertyInfo createEntityPropertyInfo(final EdmProperty property) throws EdmException, EntityProviderException {
+ private EntityPropertyInfo createEntityPropertyInfo(final EdmProperty property) throws EdmException,
+ EntityProviderException {
EdmType type = property.getType();
if (type instanceof EdmSimpleType) {
return EntityPropertyInfo.create(property);
@@ -397,7 +405,8 @@ public class EntityInfoAggregator {
}
}
- private EntityPropertyInfo createEntityPropertyInfo(final EdmFunctionImport functionImport, final EdmType type) throws EdmException, EntityProviderException {
+ private EntityPropertyInfo createEntityPropertyInfo(final EdmFunctionImport functionImport, final EdmType type)
+ throws EdmException, EntityProviderException {
EntityPropertyInfo epi;
if (type.getKind() == EdmTypeKind.COMPLEX) {
@@ -430,7 +439,8 @@ public class EntityInfoAggregator {
}
}
- private void checkTargetPathInfo(final EdmProperty property, final EntityPropertyInfo propertyInfo) throws EntityProviderException {
+ private void checkTargetPathInfo(final EdmProperty property, final EntityPropertyInfo propertyInfo)
+ throws EntityProviderException {
try {
EdmCustomizableFeedMappings customizableFeedMappings = property.getCustomizableFeedMappings();
if (customizableFeedMappings != null) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityPropertyInfo.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityPropertyInfo.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityPropertyInfo.java
index 83ab4df..931034e 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityPropertyInfo.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityPropertyInfo.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.ep.aggregator;
@@ -27,7 +27,7 @@ import org.apache.olingo.odata2.api.edm.EdmType;
/**
* Collects informations about a property of an entity.
- *
+ *
*/
public class EntityPropertyInfo {
private final String name;
@@ -37,7 +37,8 @@ public class EntityPropertyInfo {
private final String mimeType;
private final EdmMapping mapping;
- EntityPropertyInfo(final String name, final EdmType type, final EdmFacets facets, final EdmCustomizableFeedMappings customizableFeedMapping, final String mimeType, final EdmMapping mapping) {
+ EntityPropertyInfo(final String name, final EdmType type, final EdmFacets facets,
+ final EdmCustomizableFeedMappings customizableFeedMapping, final String mimeType, final EdmMapping mapping) {
this.name = name;
this.type = type;
this.facets = facets;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityTypeMapping.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityTypeMapping.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityTypeMapping.java
index 6aa8fde..c45657e 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityTypeMapping.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/EntityTypeMapping.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.ep.aggregator;
@@ -61,7 +61,8 @@ public class EntityTypeMapping {
}
@SuppressWarnings("unchecked")
- public static EntityTypeMapping create(final String name, final Map<String, Object> mappings) throws EntityProviderException {
+ public static EntityTypeMapping create(final String name, final Map<String, Object> mappings)
+ throws EntityProviderException {
if (mappings == null) {
return ENTITY_TYPE_MAPPING;
}
@@ -89,8 +90,7 @@ public class EntityTypeMapping {
/**
* If this {@link EntityTypeMapping} is complex the mapping for the property
- * with the given <code>name</code> is returned; otherwise an empty
- * {@link EntityTypeMapping} is returned.
+ * with the given <code>name</code> is returned; otherwise an empty {@link EntityTypeMapping} is returned.
* @param name
* @return the mapping for this entity type
*/
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/NavigationPropertyInfo.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/NavigationPropertyInfo.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/NavigationPropertyInfo.java
index 7918a69..1322115 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/NavigationPropertyInfo.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/aggregator/NavigationPropertyInfo.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.ep.aggregator;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/AtomServiceDocumentConsumer.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/AtomServiceDocumentConsumer.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/AtomServiceDocumentConsumer.java
index 716c4bb..fb0a41c 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/AtomServiceDocumentConsumer.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/AtomServiceDocumentConsumer.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.ep.consumer;
@@ -62,7 +62,8 @@ public class AtomServiceDocumentConsumer {
CommonAttributesImpl attributes = new CommonAttributesImpl();
try {
while (reader.hasNext()
- && !(reader.isEndElement() && Edm.NAMESPACE_APP_2007.equals(reader.getNamespaceURI()) && FormatXml.APP_SERVICE.equals(reader.getLocalName()))) {
+ && !(reader.isEndElement() && Edm.NAMESPACE_APP_2007.equals(reader.getNamespaceURI()) && FormatXml.APP_SERVICE
+ .equals(reader.getLocalName()))) {
reader.next();
if (reader.isStartElement()) {
currentHandledStartTagName = reader.getLocalName();
@@ -79,7 +80,8 @@ public class AtomServiceDocumentConsumer {
}
}
if (workspaces.isEmpty()) {
- throw new EntityProviderException(EntityProviderException.INVALID_STATE.addContent("Service element must contain at least one workspace element"));
+ throw new EntityProviderException(EntityProviderException.INVALID_STATE
+ .addContent("Service element must contain at least one workspace element"));
}
reader.close();
atomInfo.setWorkspaces(workspaces).setCommonAttributes(attributes).setExtesionElements(extElements);
@@ -88,7 +90,8 @@ public class AtomServiceDocumentConsumer {
serviceDocument.setEntitySetsInfo(atomInfo.getEntitySetsInfo());
return serviceDocument;
} catch (XMLStreamException e) {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
}
}
@@ -98,9 +101,12 @@ public class AtomServiceDocumentConsumer {
attribute.setBase(reader.getAttributeValue(null, FormatXml.XML_BASE));
attribute.setLang(reader.getAttributeValue(null, FormatXml.XML_LANG));
for (int i = 0; i < reader.getAttributeCount(); i++) {
- if (!(FormatXml.XML_BASE.equals(reader.getAttributeLocalName(i)) && Edm.PREFIX_XML.equals(reader.getAttributePrefix(i))
- || (FormatXml.XML_LANG.equals(reader.getAttributeLocalName(i)) && Edm.PREFIX_XML.equals(reader.getAttributePrefix(i)))
- || ("local".equals(reader.getAttributeNamespace(i)) || DEFAULT_PREFIX.equals(reader.getAttributePrefix(i))))) {
+ if (!(FormatXml.XML_BASE.equals(reader.getAttributeLocalName(i))
+ && Edm.PREFIX_XML.equals(reader.getAttributePrefix(i))
+ || (FormatXml.XML_LANG.equals(reader.getAttributeLocalName(i)) && Edm.PREFIX_XML.equals(reader
+ .getAttributePrefix(i)))
+ || ("local".equals(reader.getAttributeNamespace(i)) || DEFAULT_PREFIX.equals(reader.getAttributePrefix(i)))))
+ {
extAttributes.add(new ExtensionAttributeImpl()
.setName(reader.getAttributeLocalName(i))
.setNamespace(reader.getAttributeNamespace(i))
@@ -112,14 +118,17 @@ public class AtomServiceDocumentConsumer {
return attribute.setAttributes(extAttributes);
}
- private WorkspaceImpl parseWorkspace(final XMLStreamReader reader) throws XMLStreamException, EntityProviderException {
+ private WorkspaceImpl parseWorkspace(final XMLStreamReader reader)
+ throws XMLStreamException, EntityProviderException {
reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_APP_2007, FormatXml.APP_WORKSPACE);
TitleImpl title = null;
List<Collection> collections = new ArrayList<Collection>();
List<ExtensionElement> extElements = new ArrayList<ExtensionElement>();
CommonAttributesImpl attributes = parseCommonAttribute(reader);
- while (reader.hasNext() && !(reader.isEndElement() && Edm.NAMESPACE_APP_2007.equals(reader.getNamespaceURI()) && FormatXml.APP_WORKSPACE.equals(reader.getLocalName()))) {
+ while (reader.hasNext()
+ && !(reader.isEndElement() && Edm.NAMESPACE_APP_2007.equals(reader.getNamespaceURI()) && FormatXml.APP_WORKSPACE
+ .equals(reader.getLocalName()))) {
reader.next();
if (reader.isStartElement()) {
currentHandledStartTagName = reader.getLocalName();
@@ -133,12 +142,15 @@ public class AtomServiceDocumentConsumer {
}
}
if (title == null) {
- throw new EntityProviderException(EntityProviderException.INVALID_STATE.addContent("Missing element title for workspace"));
+ throw new EntityProviderException(EntityProviderException.INVALID_STATE
+ .addContent("Missing element title for workspace"));
}
- return new WorkspaceImpl().setTitle(title).setCollections(collections).setAttributes(attributes).setExtesionElements(extElements);
+ return new WorkspaceImpl().setTitle(title).setCollections(collections).setAttributes(attributes)
+ .setExtesionElements(extElements);
}
- private CollectionImpl parseCollection(final XMLStreamReader reader) throws XMLStreamException, EntityProviderException {
+ private CollectionImpl parseCollection(final XMLStreamReader reader) throws XMLStreamException,
+ EntityProviderException {
reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_APP_2007, FormatXml.APP_COLLECTION);
TitleImpl title = null;
String resourceIdentifier = reader.getAttributeValue(null, FormatXml.ATOM_HREF);
@@ -149,7 +161,9 @@ public class AtomServiceDocumentConsumer {
if (resourceIdentifier == null) {
throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent("href"));
}
- while (reader.hasNext() && !(reader.isEndElement() && Edm.NAMESPACE_APP_2007.equals(reader.getNamespaceURI()) && FormatXml.APP_COLLECTION.equals(reader.getLocalName()))) {
+ while (reader.hasNext()
+ && !(reader.isEndElement() && Edm.NAMESPACE_APP_2007.equals(reader.getNamespaceURI())
+ && FormatXml.APP_COLLECTION.equals(reader.getLocalName()))) {
reader.next();
if (reader.isStartElement()) {
currentHandledStartTagName = reader.getLocalName();
@@ -164,13 +178,16 @@ public class AtomServiceDocumentConsumer {
}
}
}
- return new CollectionImpl().setHref(resourceIdentifier).setTitle(title).setCommonAttributes(attributes).setExtesionElements(extElements).setAcceptElements(acceptList).setCategories(categories);
+ return new CollectionImpl().setHref(resourceIdentifier).setTitle(title).setCommonAttributes(attributes)
+ .setExtesionElements(extElements).setAcceptElements(acceptList).setCategories(categories);
}
private TitleImpl parseTitle(final XMLStreamReader reader) throws XMLStreamException {
reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_ATOM_2005, FormatXml.ATOM_TITLE);
String text = "";
- while (reader.hasNext() && !(reader.isEndElement() && Edm.NAMESPACE_ATOM_2005.equals(reader.getNamespaceURI()) && FormatXml.ATOM_TITLE.equals(reader.getLocalName()))) {
+ while (reader.hasNext()
+ && !(reader.isEndElement() && Edm.NAMESPACE_ATOM_2005.equals(reader.getNamespaceURI()) && FormatXml.ATOM_TITLE
+ .equals(reader.getLocalName()))) {
if (reader.isCharacters()) {
text += reader.getText();
}
@@ -183,7 +200,9 @@ public class AtomServiceDocumentConsumer {
reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_APP_2007, FormatXml.APP_ACCEPT);
CommonAttributesImpl commonAttributes = parseCommonAttribute(reader);
String text = "";
- while (reader.hasNext() && !(reader.isEndElement() && Edm.NAMESPACE_APP_2007.equals(reader.getNamespaceURI()) && FormatXml.APP_ACCEPT.equals(reader.getLocalName()))) {
+ while (reader.hasNext()
+ && !(reader.isEndElement() && Edm.NAMESPACE_APP_2007.equals(reader.getNamespaceURI()) && FormatXml.APP_ACCEPT
+ .equals(reader.getLocalName()))) {
if (reader.isCharacters()) {
text += reader.getText();
}
@@ -192,7 +211,8 @@ public class AtomServiceDocumentConsumer {
return new AcceptImpl().setCommonAttributes(commonAttributes).setText(text);
}
- private CategoriesImpl parseCategories(final XMLStreamReader reader) throws XMLStreamException, EntityProviderException {
+ private CategoriesImpl parseCategories(final XMLStreamReader reader) throws XMLStreamException,
+ EntityProviderException {
reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_APP_2007, FormatXml.APP_CATEGORIES);
CategoriesImpl categories = new CategoriesImpl();
String href = reader.getAttributeValue(null, FormatXml.ATOM_HREF);
@@ -209,7 +229,9 @@ public class AtomServiceDocumentConsumer {
categories.setFixed(Fixed.NO);
}
List<Category> categoriesList = new ArrayList<Category>();
- while (reader.hasNext() && !(reader.isEndElement() && Edm.NAMESPACE_APP_2007.equals(reader.getNamespaceURI()) && FormatXml.APP_CATEGORIES.equals(reader.getLocalName()))) {
+ while (reader.hasNext()
+ && !(reader.isEndElement() && Edm.NAMESPACE_APP_2007.equals(reader.getNamespaceURI())
+ && FormatXml.APP_CATEGORIES.equals(reader.getLocalName()))) {
reader.next();
if (reader.isStartElement()) {
currentHandledStartTagName = reader.getLocalName();
@@ -222,7 +244,8 @@ public class AtomServiceDocumentConsumer {
}
if ((href != null && fixed != null && categories.getScheme() != null) ||
(href == null && fixed == null && categories.getScheme() == null)) {
- throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent("for the element categories"));
+ throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE
+ .addContent("for the element categories"));
}
return categories;
}
@@ -237,16 +260,19 @@ public class AtomServiceDocumentConsumer {
return category.setCommonAttributes(attributes);
}
- private ExtensionElementImpl parseExtensionSansTitleElement(final XMLStreamReader reader) throws XMLStreamException, EntityProviderException {
+ private ExtensionElementImpl parseExtensionSansTitleElement(final XMLStreamReader reader) throws XMLStreamException,
+ EntityProviderException {
ExtensionElementImpl extElement = new ExtensionElementImpl();
if (!(Edm.NAMESPACE_APP_2007.equals(reader.getNamespaceURI())
- || (FormatXml.ATOM_TITLE.equals(reader.getLocalName()) && Edm.NAMESPACE_ATOM_2005.equals(reader.getNamespaceURI())))) {
+ || (FormatXml.ATOM_TITLE.equals(reader.getLocalName())
+ && Edm.NAMESPACE_ATOM_2005.equals(reader.getNamespaceURI())))) {
extElement = parseElement(reader);
}
return extElement;
}
- private ExtensionElementImpl parseExtensionElement(final XMLStreamReader reader) throws XMLStreamException, EntityProviderException {
+ private ExtensionElementImpl parseExtensionElement(final XMLStreamReader reader) throws XMLStreamException,
+ EntityProviderException {
ExtensionElementImpl extElement = null;
if (!Edm.NAMESPACE_APP_2007.equals(reader.getNamespaceURI())) {
extElement = parseElement(reader);
@@ -254,11 +280,16 @@ public class AtomServiceDocumentConsumer {
return extElement;
}
- private ExtensionElementImpl parseElement(final XMLStreamReader reader) throws XMLStreamException, EntityProviderException {
+ private ExtensionElementImpl parseElement(final XMLStreamReader reader) throws XMLStreamException,
+ EntityProviderException {
List<ExtensionElement> extensionElements = new ArrayList<ExtensionElement>();
- ExtensionElementImpl extElement = new ExtensionElementImpl().setName(reader.getLocalName()).setNamespace(reader.getNamespaceURI()).setPrefix(reader.getPrefix());
+ ExtensionElementImpl extElement =
+ new ExtensionElementImpl().setName(reader.getLocalName()).setNamespace(reader.getNamespaceURI()).setPrefix(
+ reader.getPrefix());
extElement.setAttributes(parseAttribute(reader));
- while (reader.hasNext() && !(reader.isEndElement() && extElement.getName() != null && extElement.getName().equals(reader.getLocalName()))) {
+ while (reader.hasNext()
+ && !(reader.isEndElement() && extElement.getName() != null && extElement.getName()
+ .equals(reader.getLocalName()))) {
reader.next();
if (reader.isCharacters()) {
extElement.setText(reader.getText());
@@ -301,7 +332,8 @@ public class AtomServiceDocumentConsumer {
try {
streamReader = factory.createXMLStreamReader(in);
} catch (XMLStreamException e) {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
}
return streamReader;
} else {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntityConsumer.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntityConsumer.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntityConsumer.java
index 9114781..6824808 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntityConsumer.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntityConsumer.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.ep.consumer;
@@ -43,7 +43,8 @@ public class JsonEntityConsumer {
/** Default used charset for reader */
private static final String DEFAULT_CHARSET = "UTF-8";
- public ODataEntry readEntry(final EdmEntitySet entitySet, final InputStream content, final EntityProviderReadProperties properties) throws EntityProviderException {
+ public ODataEntry readEntry(final EdmEntitySet entitySet, final InputStream content,
+ final EntityProviderReadProperties properties) throws EntityProviderException {
JsonReader reader = null;
EntityProviderException cachedException = null;
@@ -53,7 +54,9 @@ public class JsonEntityConsumer {
return new JsonEntryConsumer(reader, eia, properties).readSingleEntry();
} catch (UnsupportedEncodingException e) {
- cachedException = new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ cachedException =
+ new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
throw cachedException;
} finally {// NOPMD (suppress DoNotThrowExceptionInFinally)
if (reader != null) {
@@ -63,14 +66,16 @@ public class JsonEntityConsumer {
if (cachedException != null) {
throw cachedException;
} else {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
}
}
}
}
}
- public ODataFeed readFeed(final EdmEntitySet entitySet, final InputStream content, final EntityProviderReadProperties readProperties) throws EntityProviderException {
+ public ODataFeed readFeed(final EdmEntitySet entitySet, final InputStream content,
+ final EntityProviderReadProperties readProperties) throws EntityProviderException {
JsonReader reader = null;
EntityProviderException cachedException = null;
@@ -83,7 +88,9 @@ public class JsonEntityConsumer {
return result;
} catch (UnsupportedEncodingException e) {
- cachedException = new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ cachedException =
+ new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
throw cachedException;
} finally {// NOPMD (suppress DoNotThrowExceptionInFinally)
if (reader != null) {
@@ -93,14 +100,16 @@ public class JsonEntityConsumer {
if (cachedException != null) {
throw cachedException;
} else {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
}
}
}
}
}
- public Map<String, Object> readProperty(final EdmProperty property, final InputStream content, final EntityProviderReadProperties readProperties) throws EntityProviderException {
+ public Map<String, Object> readProperty(final EdmProperty property, final InputStream content,
+ final EntityProviderReadProperties readProperties) throws EntityProviderException {
JsonReader reader = null;
EntityProviderException cachedException = null;
@@ -108,7 +117,9 @@ public class JsonEntityConsumer {
reader = createJsonReader(content);
return new JsonPropertyConsumer().readPropertyStandalone(reader, property, readProperties);
} catch (final UnsupportedEncodingException e) {
- cachedException = new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ cachedException =
+ new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
throw cachedException;
} finally {// NOPMD (suppress DoNotThrowExceptionInFinally)
if (reader != null) {
@@ -118,7 +129,8 @@ public class JsonEntityConsumer {
if (cachedException != null) {
throw cachedException;
} else {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
}
}
}
@@ -133,7 +145,9 @@ public class JsonEntityConsumer {
reader = createJsonReader(content);
return new JsonLinkConsumer().readLink(reader, entitySet);
} catch (final UnsupportedEncodingException e) {
- cachedException = new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ cachedException =
+ new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
throw cachedException;
} finally {// NOPMD (suppress DoNotThrowExceptionInFinally)
if (reader != null) {
@@ -143,7 +157,8 @@ public class JsonEntityConsumer {
if (cachedException != null) {
throw cachedException;
} else {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
}
}
}
@@ -158,7 +173,9 @@ public class JsonEntityConsumer {
reader = createJsonReader(content);
return new JsonLinkConsumer().readLinks(reader, entitySet);
} catch (final UnsupportedEncodingException e) {
- cachedException = new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ cachedException =
+ new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
throw cachedException;
} finally {// NOPMD (suppress DoNotThrowExceptionInFinally)
if (reader != null) {
@@ -168,14 +185,16 @@ public class JsonEntityConsumer {
if (cachedException != null) {
throw cachedException;
} else {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
}
}
}
}
}
- private JsonReader createJsonReader(final Object content) throws EntityProviderException, UnsupportedEncodingException {
+ private JsonReader createJsonReader(final Object content) throws EntityProviderException,
+ UnsupportedEncodingException {
if (content == null) {
throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java
index c9129bd..e1fe75f 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.ep.consumer;
@@ -63,7 +63,8 @@ public class JsonEntryConsumer {
private final EntityProviderReadProperties readProperties;
private final ODataEntryImpl entryResult;
- public JsonEntryConsumer(final JsonReader reader, final EntityInfoAggregator eia, final EntityProviderReadProperties readProperties) {
+ public JsonEntryConsumer(final JsonReader reader, final EntityInfoAggregator eia,
+ final EntityProviderReadProperties readProperties) {
typeMappings = readProperties.getTypeMappings();
this.eia = eia;
this.readProperties = readProperties;
@@ -86,14 +87,18 @@ public class JsonEntryConsumer {
reader.endObject();
if (reader.peek() != JsonToken.END_DOCUMENT) {
- throw new EntityProviderException(EntityProviderException.END_DOCUMENT_EXPECTED.addContent(reader.peek().toString()));
+ throw new EntityProviderException(EntityProviderException.END_DOCUMENT_EXPECTED.addContent(reader.peek()
+ .toString()));
}
} catch (IOException e) {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
} catch (EdmException e) {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
} catch (IllegalStateException e) {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
}
return entryResult;
@@ -152,7 +157,8 @@ public class JsonEntryConsumer {
} else if (FormatJson.TYPE.equals(name)) {
String fullQualifiedName = eia.getEntityType().getNamespace() + Edm.DELIMITER + eia.getEntityType().getName();
if (!fullQualifiedName.equals(value)) {
- throw new EntityProviderException(EntityProviderException.INVALID_ENTITYTYPE.addContent(fullQualifiedName).addContent(value));
+ throw new EntityProviderException(EntityProviderException.INVALID_ENTITYTYPE.addContent(fullQualifiedName)
+ .addContent(value));
}
} else if (FormatJson.ETAG.equals(name)) {
entryMetadata.setEtag(value);
@@ -165,7 +171,8 @@ public class JsonEntryConsumer {
} else if (FormatJson.CONTENT_TYPE.equals(name)) {
mediaMetadata.setContentType(value);
} else {
- throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(name).addContent(FormatJson.METADATA));
+ throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(name).addContent(
+ FormatJson.METADATA));
}
}
@@ -175,12 +182,14 @@ public class JsonEntryConsumer {
private void validateMetadata() throws EdmException, EntityProviderException {
if (eia.getEntityType().hasStream()) {
if (mediaMetadata.getSourceLink() == null) {
- throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent(FormatJson.MEDIA_SRC).addContent(FormatJson.METADATA));
+ throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent(FormatJson.MEDIA_SRC)
+ .addContent(FormatJson.METADATA));
}
if (mediaMetadata.getContentType() == null) {
- throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent(FormatJson.CONTENT_TYPE).addContent(FormatJson.METADATA));
+ throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent(FormatJson.CONTENT_TYPE)
+ .addContent(FormatJson.METADATA));
}
- //TODO Mime Type Mapping
+ // TODO Mime Type Mapping
} else {
if (mediaMetadata.getContentType() != null || mediaMetadata.getEditLink() != null
|| mediaMetadata.getEtag() != null || mediaMetadata.getSourceLink() != null) {
@@ -189,7 +198,8 @@ public class JsonEntryConsumer {
}
}
- private void readNavigationProperty(final String navigationPropertyName) throws IOException, EntityProviderException, EdmException {
+ private void readNavigationProperty(final String navigationPropertyName) throws IOException, EntityProviderException,
+ EdmException {
NavigationPropertyInfo navigationPropertyInfo = eia.getNavigationPropertyInfo(navigationPropertyName);
if (navigationPropertyInfo == null) {
throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT.addContent(navigationPropertyName));
@@ -209,14 +219,16 @@ public class JsonEntryConsumer {
}
reader.endObject();
} else {
- EdmNavigationProperty navigationProperty = (EdmNavigationProperty) eia.getEntityType().getProperty(navigationPropertyName);
+ EdmNavigationProperty navigationProperty =
+ (EdmNavigationProperty) eia.getEntityType().getProperty(navigationPropertyName);
EdmEntitySet inlineEntitySet = eia.getEntitySet().getRelatedEntitySet(navigationProperty);
EntityInfoAggregator inlineEia = EntityInfoAggregator.create(inlineEntitySet);
EntityProviderReadProperties inlineReadProperties;
OnReadInlineContent callback = readProperties.getCallback();
try {
if (callback == null) {
- inlineReadProperties = EntityProviderReadProperties.init().mergeSemantic(readProperties.getMergeSemantic()).build();
+ inlineReadProperties =
+ EntityProviderReadProperties.init().mergeSemantic(readProperties.getMergeSemantic()).build();
} else {
inlineReadProperties = callback.receiveReadProperties(readProperties, navigationProperty);
@@ -247,23 +259,27 @@ public class JsonEntryConsumer {
}
} catch (ODataApplicationException e) {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
}
}
reader.endObject();
} else {
- final EdmNavigationProperty navigationProperty = (EdmNavigationProperty) eia.getEntityType().getProperty(navigationPropertyName);
+ final EdmNavigationProperty navigationProperty =
+ (EdmNavigationProperty) eia.getEntityType().getProperty(navigationPropertyName);
final EdmEntitySet inlineEntitySet = eia.getEntitySet().getRelatedEntitySet(navigationProperty);
final EntityInfoAggregator inlineInfo = EntityInfoAggregator.create(inlineEntitySet);
OnReadInlineContent callback = readProperties.getCallback();
EntityProviderReadProperties inlineReadProperties;
if (callback == null) {
- inlineReadProperties = EntityProviderReadProperties.init().mergeSemantic(readProperties.getMergeSemantic()).build();
+ inlineReadProperties =
+ EntityProviderReadProperties.init().mergeSemantic(readProperties.getMergeSemantic()).build();
} else {
try {
inlineReadProperties = callback.receiveReadProperties(readProperties, navigationProperty);
} catch (final ODataApplicationException e) {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
}
}
ODataFeed feed = new JsonFeedConsumer(reader, inlineInfo, inlineReadProperties).readInlineFeedStandalone();
@@ -276,7 +292,8 @@ public class JsonEntryConsumer {
try {
callback.handleReadFeed(result);
} catch (final ODataApplicationException e) {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
}
}
}
@@ -300,9 +317,9 @@ public class JsonEntryConsumer {
}
private ODataEntry readInlineEntry(final String name) throws EdmException, EntityProviderException, IOException {
- //consume the already started content
+ // consume the already started content
handleName(name);
- //consume the rest of the entry content
+ // consume the rest of the entry content
readEntryContent();
return entryResult;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java
index bcc6631..d0ec1e1 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.ep.consumer;
@@ -47,7 +47,8 @@ public class JsonFeedConsumer {
private FeedMetadataImpl feedMetadata = new FeedMetadataImpl();
private boolean resultsArrayPresent = false;
- public JsonFeedConsumer(final JsonReader reader, final EntityInfoAggregator eia, final EntityProviderReadProperties readProperties) {
+ public JsonFeedConsumer(final JsonReader reader, final EntityInfoAggregator eia,
+ final EntityProviderReadProperties readProperties) {
this.reader = reader;
this.eia = eia;
this.readProperties = readProperties;
@@ -59,15 +60,19 @@ public class JsonFeedConsumer {
if (reader.peek() != JsonToken.END_DOCUMENT) {
- throw new EntityProviderException(EntityProviderException.END_DOCUMENT_EXPECTED.addContent(reader.peek().toString()));
+ throw new EntityProviderException(EntityProviderException.END_DOCUMENT_EXPECTED.addContent(reader.peek()
+ .toString()));
}
} catch (IOException e) {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
} catch (EdmException e) {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
} catch (IllegalStateException e) {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
}
return new ODataFeedImpl(entries, feedMetadata);
}
@@ -119,7 +124,8 @@ public class JsonFeedConsumer {
String nextLink = reader.nextString();
feedMetadata.setNextLink(nextLink);
} else {
- throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(nextName).addContent("JsonFeed"));
+ throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(nextName).addContent(
+ "JsonFeed"));
}
} else if (FormatJson.DELTA.equals(nextName)) {
@@ -127,10 +133,12 @@ public class JsonFeedConsumer {
String deltaLink = reader.nextString();
feedMetadata.setDeltaLink(deltaLink);
} else {
- throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(nextName).addContent("JsonFeed"));
+ throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(nextName).addContent(
+ "JsonFeed"));
}
} else {
- throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(nextName).addContent("JsonFeed"));
+ throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(nextName).addContent(
+ "JsonFeed"));
}
}
@@ -143,7 +151,8 @@ public class JsonFeedConsumer {
reader.endArray();
}
- protected static void readInlineCount(final JsonReader reader, final FeedMetadataImpl feedMetadata) throws IOException, EntityProviderException {
+ protected static void readInlineCount(final JsonReader reader, final FeedMetadataImpl feedMetadata)
+ throws IOException, EntityProviderException {
if (reader.peek() == JsonToken.STRING && feedMetadata.getInlineCount() == null) {
int inlineCount;
try {
@@ -161,10 +170,11 @@ public class JsonFeedConsumer {
}
}
- protected ODataFeed readStartedInlineFeed(final String name) throws EdmException, EntityProviderException, IOException {
- //consume the already started content
+ protected ODataFeed readStartedInlineFeed(final String name) throws EdmException, EntityProviderException,
+ IOException {
+ // consume the already started content
handleName(name);
- //consume the rest of the entry content
+ // consume the rest of the entry content
readFeedContent();
return new ODataFeedImpl(entries, feedMetadata);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonLinkConsumer.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonLinkConsumer.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonLinkConsumer.java
index 80acfa4..2b6f038 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonLinkConsumer.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonLinkConsumer.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.ep.consumer;
@@ -56,7 +56,8 @@ public class JsonLinkConsumer {
if (FormatJson.URI.equals(nextName) && reader.peek() == JsonToken.STRING) {
result = reader.nextString();
} else {
- throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(FormatJson.D + " or " + FormatJson.URI).addContent(nextName));
+ throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(
+ FormatJson.D + " or " + FormatJson.URI).addContent(nextName));
}
reader.endObject();
if (wrapped) {
@@ -67,9 +68,11 @@ public class JsonLinkConsumer {
return result;
} catch (final IOException e) {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
} catch (final IllegalStateException e) {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
}
}
@@ -112,13 +115,15 @@ public class JsonLinkConsumer {
if (FormatJson.RESULTS.equals(nextName)) {
links = readLinksArray(reader);
} else {
- throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(FormatJson.RESULTS).addContent(nextName));
+ throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(FormatJson.RESULTS)
+ .addContent(nextName));
}
if (reader.hasNext() && reader.peek() == JsonToken.NAME) {
if (FormatJson.COUNT.equals(reader.nextName())) {
JsonFeedConsumer.readInlineCount(reader, feedMetadata);
} else {
- throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(FormatJson.COUNT).addContent(nextName));
+ throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(FormatJson.COUNT)
+ .addContent(nextName));
}
}
for (; openedObjects > 0; openedObjects--) {
@@ -127,9 +132,11 @@ public class JsonLinkConsumer {
reader.peek(); // to assert end of document
} catch (final IOException e) {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
} catch (final IllegalStateException e) {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
}
return links;
@@ -145,7 +152,8 @@ public class JsonLinkConsumer {
if (FormatJson.URI.equals(nextName) && reader.peek() == JsonToken.STRING) {
links.add(reader.nextString());
} else {
- throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(FormatJson.URI).addContent(nextName));
+ throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(FormatJson.URI)
+ .addContent(nextName));
}
reader.endObject();
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/a030e42b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumer.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumer.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumer.java
index ab67bfb..af1262d 100644
--- a/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumer.java
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonPropertyConsumer.java
@@ -1,20 +1,20 @@
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
******************************************************************************/
package org.apache.olingo.odata2.core.ep.consumer;
@@ -43,7 +43,8 @@ import com.google.gson.stream.JsonToken;
*/
public class JsonPropertyConsumer {
- public Map<String, Object> readPropertyStandalone(final JsonReader reader, final EdmProperty property, final EntityProviderReadProperties readProperties) throws EntityProviderException {
+ public Map<String, Object> readPropertyStandalone(final JsonReader reader, final EdmProperty property,
+ final EntityProviderReadProperties readProperties) throws EntityProviderException {
try {
EntityPropertyInfo entityPropertyInfo = EntityInfoAggregator.create(property);
Map<String, Object> typeMappings = readProperties == null ? null : readProperties.getTypeMappings();
@@ -62,18 +63,23 @@ public class JsonPropertyConsumer {
reader.endObject();
if (reader.peek() != JsonToken.END_DOCUMENT) {
- throw new EntityProviderException(EntityProviderException.END_DOCUMENT_EXPECTED.addContent(reader.peek().toString()));
+ throw new EntityProviderException(EntityProviderException.END_DOCUMENT_EXPECTED.addContent(reader.peek()
+ .toString()));
}
return result;
} catch (final IOException e) {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
} catch (final IllegalStateException e) {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
}
}
- private void handleName(final JsonReader reader, final Map<String, Object> typeMappings, final EntityPropertyInfo entityPropertyInfo, final Map<String, Object> result, final String nextName) throws EntityProviderException {
+ private void handleName(final JsonReader reader, final Map<String, Object> typeMappings,
+ final EntityPropertyInfo entityPropertyInfo, final Map<String, Object> result, final String nextName)
+ throws EntityProviderException {
if (!entityPropertyInfo.getName().equals(nextName)) {
throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT.addContent(nextName));
}
@@ -85,19 +91,23 @@ public class JsonPropertyConsumer {
result.put(nextName, propertyValue);
}
- protected Object readPropertyValue(final JsonReader reader, final EntityPropertyInfo entityPropertyInfo, final Object typeMapping) throws EntityProviderException {
+ protected Object readPropertyValue(final JsonReader reader, final EntityPropertyInfo entityPropertyInfo,
+ final Object typeMapping) throws EntityProviderException {
try {
return entityPropertyInfo.isComplex() ?
readComplexProperty(reader, (EntityComplexPropertyInfo) entityPropertyInfo, typeMapping) :
readSimpleProperty(reader, entityPropertyInfo, typeMapping);
} catch (final EdmException e) {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
} catch (final IOException e) {
- throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass().getSimpleName()), e);
+ throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
+ .getSimpleName()), e);
}
}
- private Object readSimpleProperty(final JsonReader reader, final EntityPropertyInfo entityPropertyInfo, final Object typeMapping) throws EdmException, EntityProviderException, IOException {
+ private Object readSimpleProperty(final JsonReader reader, final EntityPropertyInfo entityPropertyInfo,
+ final Object typeMapping) throws EdmException, EntityProviderException, IOException {
final EdmSimpleType type = (EdmSimpleType) entityPropertyInfo.getType();
Object value = null;
final JsonToken tokenType = reader.peek();
@@ -110,7 +120,8 @@ public class JsonPropertyConsumer {
value = reader.nextBoolean();
value = value.toString();
} else {
- throw new EntityProviderException(EntityProviderException.INVALID_PROPERTY_VALUE.addContent(entityPropertyInfo.getName()));
+ throw new EntityProviderException(EntityProviderException.INVALID_PROPERTY_VALUE
+ .addContent(entityPropertyInfo.getName()));
}
break;
case Byte:
@@ -121,14 +132,16 @@ public class JsonPropertyConsumer {
value = reader.nextInt();
value = value.toString();
} else {
- throw new EntityProviderException(EntityProviderException.INVALID_PROPERTY_VALUE.addContent(entityPropertyInfo.getName()));
+ throw new EntityProviderException(EntityProviderException.INVALID_PROPERTY_VALUE
+ .addContent(entityPropertyInfo.getName()));
}
break;
default:
if (tokenType == JsonToken.STRING) {
value = reader.nextString();
} else {
- throw new EntityProviderException(EntityProviderException.INVALID_PROPERTY_VALUE.addContent(entityPropertyInfo.getName()));
+ throw new EntityProviderException(EntityProviderException.INVALID_PROPERTY_VALUE
+ .addContent(entityPropertyInfo.getName()));
}
break;
}
@@ -139,11 +152,13 @@ public class JsonPropertyConsumer {
}
@SuppressWarnings("unchecked")
- private Object readComplexProperty(final JsonReader reader, final EntityComplexPropertyInfo complexPropertyInfo, final Object typeMapping) throws EdmException, EntityProviderException, IOException {
+ private Object readComplexProperty(final JsonReader reader, final EntityComplexPropertyInfo complexPropertyInfo,
+ final Object typeMapping) throws EdmException, EntityProviderException, IOException {
if (reader.peek().equals(JsonToken.NULL)) {
reader.nextNull();
if (complexPropertyInfo.isMandatory()) {
- throw new EntityProviderException(EntityProviderException.INVALID_PROPERTY_VALUE.addContent(complexPropertyInfo.getName()));
+ throw new EntityProviderException(EntityProviderException.INVALID_PROPERTY_VALUE.addContent(complexPropertyInfo
+ .getName()));
}
return null;
}
@@ -156,7 +171,8 @@ public class JsonPropertyConsumer {
if (typeMapping instanceof Map) {
mapping = (Map<String, Object>) typeMapping;
} else {
- throw new EntityProviderException(EntityProviderException.INVALID_MAPPING.addContent(complexPropertyInfo.getName()));
+ throw new EntityProviderException(EntityProviderException.INVALID_MAPPING.addContent(complexPropertyInfo
+ .getName()));
}
} else {
mapping = new HashMap<String, Object>();
@@ -168,12 +184,15 @@ public class JsonPropertyConsumer {
reader.beginObject();
childName = reader.nextName();
if (!FormatJson.TYPE.equals(childName)) {
- throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent(FormatJson.TYPE).addContent(FormatJson.METADATA));
+ throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE.addContent(FormatJson.TYPE)
+ .addContent(FormatJson.METADATA));
}
String actualTypeName = reader.nextString();
- String expectedTypeName = complexPropertyInfo.getType().getNamespace() + Edm.DELIMITER + complexPropertyInfo.getType().getName();
+ String expectedTypeName =
+ complexPropertyInfo.getType().getNamespace() + Edm.DELIMITER + complexPropertyInfo.getType().getName();
if (!expectedTypeName.equals(actualTypeName)) {
- throw new EntityProviderException(EntityProviderException.INVALID_ENTITYTYPE.addContent(expectedTypeName).addContent(actualTypeName));
+ throw new EntityProviderException(EntityProviderException.INVALID_ENTITYTYPE.addContent(expectedTypeName)
+ .addContent(actualTypeName));
}
reader.endObject();
} else {