[OLINGO-1191]Code improvements
This commit is contained in:
parent
96223df38d
commit
8f40d49c46
|
@ -62,12 +62,12 @@ class ClientCsdlParameter extends CsdlParameter implements Serializable {
|
|||
parameter.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("MaxLength".equals(jp.getCurrentName())) {
|
||||
final String maxLenght = jp.nextTextValue();
|
||||
parameter.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
parameter.setMaxLength("max".equalsIgnoreCase(maxLenght) ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
} else if ("Precision".equals(jp.getCurrentName())) {
|
||||
parameter.setPrecision(Integer.valueOf(jp.nextTextValue()));
|
||||
} else if ("Scale".equals(jp.getCurrentName())) {
|
||||
final String scale = jp.nextTextValue();
|
||||
parameter.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
|
||||
parameter.setScale("variable".equalsIgnoreCase(scale) ? 0 : Integer.valueOf(scale));
|
||||
} else if ("SRID".equals(jp.getCurrentName())) {
|
||||
final String srid = jp.nextTextValue();
|
||||
if (srid != null) {
|
||||
|
|
|
@ -64,12 +64,12 @@ class ClientCsdlProperty extends CsdlProperty implements Serializable {
|
|||
property.setDefaultValue(jp.nextTextValue());
|
||||
} else if ("MaxLength".equals(jp.getCurrentName())) {
|
||||
final String maxLenght = jp.nextTextValue();
|
||||
property.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
property.setMaxLength("max".equalsIgnoreCase(maxLenght) ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
} else if ("Precision".equals(jp.getCurrentName())) {
|
||||
property.setPrecision(Integer.valueOf(jp.nextTextValue()));
|
||||
} else if ("Scale".equals(jp.getCurrentName())) {
|
||||
final String scale = jp.nextTextValue();
|
||||
property.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
|
||||
property.setScale("variable".equalsIgnoreCase(scale) ? 0 : Integer.valueOf(scale));
|
||||
} else if ("Unicode".equals(jp.getCurrentName())) {
|
||||
property.setUnicode(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("SRID".equals(jp.getCurrentName())) {
|
||||
|
|
|
@ -59,12 +59,12 @@ class ClientCsdlReturnType extends CsdlReturnType implements Serializable {
|
|||
returnType.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("MaxLength".equals(jp.getCurrentName())) {
|
||||
final String maxLenght = jp.nextTextValue();
|
||||
returnType.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
returnType.setMaxLength("max".equalsIgnoreCase(maxLenght) ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
} else if ("Precision".equals(jp.getCurrentName())) {
|
||||
returnType.setPrecision(Integer.valueOf(jp.nextTextValue()));
|
||||
} else if ("Scale".equals(jp.getCurrentName())) {
|
||||
final String scale = jp.nextTextValue();
|
||||
returnType.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
|
||||
returnType.setScale("variable".equalsIgnoreCase(scale) ? 0 : Integer.valueOf(scale));
|
||||
} else if ("SRID".equals(jp.getCurrentName())) {
|
||||
final String srid = jp.nextTextValue();
|
||||
if (srid != null) {
|
||||
|
|
|
@ -59,12 +59,12 @@ class ClientCsdlTerm extends CsdlTerm implements Serializable {
|
|||
term.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
|
||||
} else if ("MaxLength".equals(jp.getCurrentName())) {
|
||||
final String maxLenght = jp.nextTextValue();
|
||||
term.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
term.setMaxLength("max".equalsIgnoreCase(maxLenght) ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
} else if ("Precision".equals(jp.getCurrentName())) {
|
||||
term.setPrecision(Integer.valueOf(jp.nextTextValue()));
|
||||
} else if ("Scale".equals(jp.getCurrentName())) {
|
||||
final String scale = jp.nextTextValue();
|
||||
term.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
|
||||
term.setScale("variable".equalsIgnoreCase(scale) ? 0 : Integer.valueOf(scale));
|
||||
} else if ("SRID".equals(jp.getCurrentName())) {
|
||||
final String srid = jp.nextTextValue();
|
||||
if (srid != null) {
|
||||
|
|
|
@ -57,7 +57,7 @@ class ClientCsdlTypeDefinition extends CsdlTypeDefinition implements Serializabl
|
|||
typeDefinition.setPrecision(jp.nextIntValue(0));
|
||||
} else if ("Scale".equals(jp.getCurrentName())) {
|
||||
final String scale = jp.nextTextValue();
|
||||
typeDefinition.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
|
||||
typeDefinition.setScale("variable".equalsIgnoreCase(scale) ? 0 : Integer.valueOf(scale));
|
||||
} else if ("SRID".equals(jp.getCurrentName())) {
|
||||
final String srid = jp.nextTextValue();
|
||||
if (srid != null) {
|
||||
|
|
|
@ -51,12 +51,12 @@ class ClientCsdlCast extends CsdlCast implements Serializable {
|
|||
cast.getAnnotations().add(jp.readValueAs(ClientCsdlAnnotation.class));
|
||||
} else if ("MaxLength".equals(jp.getCurrentName())) {
|
||||
final String maxLenght = jp.nextTextValue();
|
||||
cast.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
cast.setMaxLength("max".equalsIgnoreCase(maxLenght) ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
} else if ("Precision".equals(jp.getCurrentName())) {
|
||||
cast.setPrecision(Integer.valueOf(jp.nextTextValue()));
|
||||
} else if ("Scale".equals(jp.getCurrentName())) {
|
||||
final String scale = jp.nextTextValue();
|
||||
cast.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
|
||||
cast.setScale("variable".equalsIgnoreCase(scale) ? 0 : Integer.valueOf(scale));
|
||||
} else if ("SRID".equals(jp.getCurrentName())) {
|
||||
final String srid = jp.nextTextValue();
|
||||
if (srid != null) {
|
||||
|
|
|
@ -90,7 +90,7 @@ public abstract class ClientCsdlDynamicExpression extends CsdlDynamicExpression
|
|||
}
|
||||
not.setLeft(jp.readValueAs(ClientCsdlDynamicExpression.class));
|
||||
// Search for end object
|
||||
while (jp.getCurrentToken() != JsonToken.END_OBJECT || !jp.getCurrentName().equals("Not")) {
|
||||
while (jp.getCurrentToken() != JsonToken.END_OBJECT || !"Not".equals(jp.getCurrentName())) {
|
||||
jp.nextToken();
|
||||
}
|
||||
|
||||
|
|
|
@ -50,12 +50,12 @@ class ClientCsdlIsOf extends CsdlIsOf implements Serializable {
|
|||
isof.getAnnotations().add(jp.readValueAs(ClientCsdlAnnotation.class));
|
||||
} else if ("MaxLength".equals(jp.getCurrentName())) {
|
||||
final String maxLenght = jp.nextTextValue();
|
||||
isof.setMaxLength(maxLenght.equalsIgnoreCase("max") ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
isof.setMaxLength("max".equalsIgnoreCase(maxLenght) ? Integer.MAX_VALUE : Integer.valueOf(maxLenght));
|
||||
} else if ("Precision".equals(jp.getCurrentName())) {
|
||||
isof.setPrecision(Integer.valueOf(jp.nextTextValue()));
|
||||
} else if ("Scale".equals(jp.getCurrentName())) {
|
||||
final String scale = jp.nextTextValue();
|
||||
isof.setScale(scale.equalsIgnoreCase("variable") ? 0 : Integer.valueOf(scale));
|
||||
isof.setScale("variable".equalsIgnoreCase(scale) ? 0 : Integer.valueOf(scale));
|
||||
} else if ("SRID".equals(jp.getCurrentName())) {
|
||||
final String srid = jp.nextTextValue();
|
||||
if (srid != null) {
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.stream.XMLOutputFactory;
|
||||
|
@ -154,7 +155,7 @@ public class AtomSerializer implements ODataSerializer {
|
|||
}
|
||||
|
||||
EdmTypeInfo typeInfo = null;
|
||||
if (property.getType() != null && !property.getValueType().name().equalsIgnoreCase("COMPLEX")) {
|
||||
if (property.getType() != null && !"COMPLEX".equalsIgnoreCase(property.getValueType().name())) {
|
||||
typeInfo = new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
|
||||
if (!EdmPrimitiveTypeKind.String.getFullQualifiedName().toString().equals(typeInfo.internal())) {
|
||||
writer.writeAttribute(Constants.PREFIX_METADATA, Constants.NS_METADATA,
|
||||
|
@ -279,13 +280,13 @@ public class AtomSerializer implements ODataSerializer {
|
|||
}
|
||||
}
|
||||
}
|
||||
for (String title : entitySetLinks.keySet()) {
|
||||
final List<String>entitySetLink = entitySetLinks.get(title);
|
||||
for (Entry<String, List<String>> entry : entitySetLinks.entrySet()) {
|
||||
final List<String>entitySetLink = entry.getValue();
|
||||
if (!entitySetLink.isEmpty()) {
|
||||
Link link = new Link();
|
||||
link.setTitle(title);
|
||||
link.setTitle(entry.getKey());
|
||||
link.setType(Constants.ENTITY_SET_NAVIGATION_LINK_TYPE);
|
||||
link.setRel(Constants.NS_NAVIGATION_LINK_REL+title);
|
||||
link.setRel(Constants.NS_NAVIGATION_LINK_REL+entry.getKey());
|
||||
|
||||
writeLink(writer, link, new ExtraContent() {
|
||||
@Override
|
||||
|
@ -302,7 +303,7 @@ public class AtomSerializer implements ODataSerializer {
|
|||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void links(final XMLStreamWriter writer, final List<Link> links)
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Calendar;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.olingo.client.api.EdmEnabledODataClient;
|
||||
|
@ -730,8 +731,8 @@ public class ODataBinderImpl implements ODataBinder {
|
|||
}
|
||||
|
||||
if (!countMap.isEmpty()) {
|
||||
for (String name:countMap.keySet()) {
|
||||
entity.addLink(createLinkFromEmptyNavigationProperty(name, countMap.get(name)));
|
||||
for (Entry<String, Integer> entry : countMap.entrySet()) {
|
||||
entity.addLink(createLinkFromEmptyNavigationProperty(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,6 @@ public final class URIUtils {
|
|||
/**
|
||||
* Logger.
|
||||
*/
|
||||
// private static final Logger LOG = LoggerFactory.getLogger(URIUtils.class);
|
||||
|
||||
private static final Pattern ENUM_VALUE = Pattern.compile("(.+\\.)?.+'.+'");
|
||||
private static final String URI_OPTIONS = "/$";
|
||||
|
|
|
@ -93,9 +93,9 @@ public class EdmNavigationPropertyImpl extends AbstractEdmNamed implements EdmNa
|
|||
|
||||
@Override
|
||||
public String getReferencingPropertyName(final String referencedPropertyName) {
|
||||
final List<CsdlReferentialConstraint> referentialConstraints = navigationProperty.getReferentialConstraints();
|
||||
if (referentialConstraints != null) {
|
||||
for (CsdlReferentialConstraint constraint : referentialConstraints) {
|
||||
final List<CsdlReferentialConstraint> refConstraints = navigationProperty.getReferentialConstraints();
|
||||
if (refConstraints != null) {
|
||||
for (CsdlReferentialConstraint constraint : refConstraints) {
|
||||
if (constraint.getReferencedProperty().equals(referencedPropertyName)) {
|
||||
return constraint.getProperty();
|
||||
}
|
||||
|
|
|
@ -161,105 +161,105 @@ public class EdmSchemaImpl extends AbstractEdmAnnotatable implements EdmSchema {
|
|||
}
|
||||
|
||||
protected List<EdmTypeDefinition> createTypeDefinitions() {
|
||||
final List<EdmTypeDefinition> typeDefinitions = new ArrayList<EdmTypeDefinition>();
|
||||
final List<EdmTypeDefinition> typeDefns = new ArrayList<EdmTypeDefinition>();
|
||||
final List<CsdlTypeDefinition> providerTypeDefinitions = schema.getTypeDefinitions();
|
||||
if (providerTypeDefinitions != null) {
|
||||
for (CsdlTypeDefinition def : providerTypeDefinitions) {
|
||||
FullQualifiedName typeDefName = new FullQualifiedName(namespace, def.getName());
|
||||
EdmTypeDefinitionImpl typeDefImpl = new EdmTypeDefinitionImpl(edm, typeDefName, def);
|
||||
typeDefinitions.add(typeDefImpl);
|
||||
typeDefns.add(typeDefImpl);
|
||||
edm.cacheTypeDefinition(typeDefName, typeDefImpl);
|
||||
}
|
||||
}
|
||||
return typeDefinitions;
|
||||
return typeDefns;
|
||||
}
|
||||
|
||||
protected List<EdmEnumType> createEnumTypes() {
|
||||
final List<EdmEnumType> enumTypes = new ArrayList<EdmEnumType>();
|
||||
final List<EdmEnumType> enumTyps = new ArrayList<EdmEnumType>();
|
||||
final List<CsdlEnumType> providerEnumTypes = schema.getEnumTypes();
|
||||
if (providerEnumTypes != null) {
|
||||
for (CsdlEnumType enumType : providerEnumTypes) {
|
||||
FullQualifiedName enumName = new FullQualifiedName(namespace, enumType.getName());
|
||||
EdmEnumType enumTypeImpl = new EdmEnumTypeImpl(edm, enumName, enumType);
|
||||
enumTypes.add(enumTypeImpl);
|
||||
enumTyps.add(enumTypeImpl);
|
||||
edm.cacheEnumType(enumName, enumTypeImpl);
|
||||
}
|
||||
}
|
||||
return enumTypes;
|
||||
return enumTyps;
|
||||
}
|
||||
|
||||
protected List<EdmEntityType> createEntityTypes() {
|
||||
final List<EdmEntityType> entityTypes = new ArrayList<EdmEntityType>();
|
||||
final List<EdmEntityType> edmEntityTypes = new ArrayList<EdmEntityType>();
|
||||
final List<CsdlEntityType> providerEntityTypes = schema.getEntityTypes();
|
||||
if (providerEntityTypes != null) {
|
||||
for (CsdlEntityType entityType : providerEntityTypes) {
|
||||
FullQualifiedName entityTypeName = new FullQualifiedName(namespace, entityType.getName());
|
||||
EdmEntityTypeImpl entityTypeImpl = new EdmEntityTypeImpl(edm, entityTypeName, entityType);
|
||||
entityTypes.add(entityTypeImpl);
|
||||
edmEntityTypes.add(entityTypeImpl);
|
||||
edm.cacheEntityType(entityTypeName, entityTypeImpl);
|
||||
}
|
||||
}
|
||||
return entityTypes;
|
||||
return edmEntityTypes;
|
||||
}
|
||||
|
||||
protected List<EdmComplexType> createComplexTypes() {
|
||||
final List<EdmComplexType> complexTypes = new ArrayList<EdmComplexType>();
|
||||
final List<EdmComplexType> edmComplexTypes = new ArrayList<EdmComplexType>();
|
||||
final List<CsdlComplexType> providerComplexTypes = schema.getComplexTypes();
|
||||
if (providerComplexTypes != null) {
|
||||
for (CsdlComplexType complexType : providerComplexTypes) {
|
||||
FullQualifiedName comlexTypeName = new FullQualifiedName(namespace, complexType.getName());
|
||||
EdmComplexTypeImpl complexTypeImpl = new EdmComplexTypeImpl(edm, comlexTypeName, complexType);
|
||||
complexTypes.add(complexTypeImpl);
|
||||
edmComplexTypes.add(complexTypeImpl);
|
||||
edm.cacheComplexType(comlexTypeName, complexTypeImpl);
|
||||
}
|
||||
}
|
||||
return complexTypes;
|
||||
return edmComplexTypes;
|
||||
}
|
||||
|
||||
protected List<EdmAction> createActions() {
|
||||
final List<EdmAction> actions = new ArrayList<EdmAction>();
|
||||
final List<EdmAction> edmActions = new ArrayList<EdmAction>();
|
||||
final List<CsdlAction> providerActions = schema.getActions();
|
||||
if (providerActions != null) {
|
||||
for (CsdlAction action : providerActions) {
|
||||
FullQualifiedName actionName = new FullQualifiedName(namespace, action.getName());
|
||||
EdmActionImpl edmActionImpl = new EdmActionImpl(edm, actionName, action);
|
||||
actions.add(edmActionImpl);
|
||||
edmActions.add(edmActionImpl);
|
||||
edm.cacheAction(actionName, edmActionImpl);
|
||||
}
|
||||
}
|
||||
return actions;
|
||||
return edmActions;
|
||||
}
|
||||
|
||||
protected List<EdmFunction> createFunctions() {
|
||||
final List<EdmFunction> functions = new ArrayList<EdmFunction>();
|
||||
final List<EdmFunction> edmFunctions = new ArrayList<EdmFunction>();
|
||||
final List<CsdlFunction> providerFunctions = schema.getFunctions();
|
||||
if (providerFunctions != null) {
|
||||
for (CsdlFunction function : providerFunctions) {
|
||||
FullQualifiedName functionName = new FullQualifiedName(namespace, function.getName());
|
||||
EdmFunctionImpl functionImpl = new EdmFunctionImpl(edm, functionName, function);
|
||||
functions.add(functionImpl);
|
||||
edmFunctions.add(functionImpl);
|
||||
edm.cacheFunction(functionName, functionImpl);
|
||||
}
|
||||
}
|
||||
return functions;
|
||||
return edmFunctions;
|
||||
}
|
||||
|
||||
protected List<EdmTerm> createTerms() {
|
||||
final List<EdmTerm> terms = new ArrayList<EdmTerm>();
|
||||
final List<EdmTerm> edmTerms = new ArrayList<EdmTerm>();
|
||||
final List<CsdlTerm> providerTerms = schema.getTerms();
|
||||
if (providerTerms != null) {
|
||||
for (CsdlTerm term : providerTerms) {
|
||||
FullQualifiedName termName = new FullQualifiedName(namespace, term.getName());
|
||||
EdmTermImpl termImpl = new EdmTermImpl(edm, getNamespace(), term);
|
||||
terms.add(termImpl);
|
||||
edmTerms.add(termImpl);
|
||||
edm.cacheTerm(termName, termImpl);
|
||||
}
|
||||
}
|
||||
return terms;
|
||||
return edmTerms;
|
||||
}
|
||||
|
||||
protected List<EdmAnnotations> createAnnotationGroups() {
|
||||
final List<EdmAnnotations> annotationGroups = new ArrayList<EdmAnnotations>();
|
||||
final List<EdmAnnotations> edmAnnotationGroups = new ArrayList<EdmAnnotations>();
|
||||
final List<CsdlAnnotations> providerAnnotations =
|
||||
schema.getAnnotationGroups();
|
||||
if (providerAnnotations != null) {
|
||||
|
@ -271,23 +271,23 @@ public class EdmSchemaImpl extends AbstractEdmAnnotatable implements EdmSchema {
|
|||
targetName = new FullQualifiedName(namespace, annotationGroup.getTarget());
|
||||
}
|
||||
EdmAnnotationsImpl annotationsImpl = new EdmAnnotationsImpl(edm, annotationGroup);
|
||||
annotationGroups.add(annotationsImpl);
|
||||
edmAnnotationGroups.add(annotationsImpl);
|
||||
edm.cacheAnnotationGroup(targetName, annotationsImpl);
|
||||
}
|
||||
}
|
||||
return annotationGroups;
|
||||
return edmAnnotationGroups;
|
||||
}
|
||||
|
||||
protected List<EdmAnnotation> createAnnotations() {
|
||||
final List<EdmAnnotation> annotations = new ArrayList<EdmAnnotation>();
|
||||
final List<EdmAnnotation> edmAnnotations = new ArrayList<EdmAnnotation>();
|
||||
final List<CsdlAnnotation> providerAnnotations =
|
||||
schema.getAnnotations();
|
||||
if (providerAnnotations != null) {
|
||||
for (CsdlAnnotation annotation : providerAnnotations) {
|
||||
EdmAnnotationImpl annotationImpl = new EdmAnnotationImpl(edm, annotation);
|
||||
annotations.add(annotationImpl);
|
||||
edmAnnotations.add(annotationImpl);
|
||||
}
|
||||
}
|
||||
return annotations;
|
||||
return edmAnnotations;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public final class EdmDecimal extends SingletonPrimitiveType {
|
|||
|
||||
final Matcher matcher = PATTERN.matcher(value);
|
||||
matcher.matches();
|
||||
final int significantIntegerDigits = matcher.group(1).equals("0") ? 0 : matcher.group(1).length();
|
||||
final int significantIntegerDigits = "0".equals(matcher.group(1)) ? 0 : matcher.group(1).length();
|
||||
final int decimals = matcher.group(2) == null ? 0 : matcher.group(2).length();
|
||||
return (precision == null || precision >= significantIntegerDigits + decimals)
|
||||
&& (decimals <= (scale == null ? 0 : scale));
|
||||
|
|
|
@ -277,19 +277,19 @@ public class MetadataParser {
|
|||
|
||||
private void loadCoreVocabulary(SchemaBasedEdmProvider provider,
|
||||
String namespace) throws XMLStreamException {
|
||||
if(namespace.equalsIgnoreCase("Org.OData.Core.V1")) {
|
||||
if("Org.OData.Core.V1".equalsIgnoreCase(namespace)) {
|
||||
loadLocalVocabularySchema(provider, "Org.OData.Core.V1", "Org.OData.Core.V1.xml");
|
||||
} else if (namespace.equalsIgnoreCase("Org.OData.Capabilities.V1")) {
|
||||
} else if ("Org.OData.Capabilities.V1".equalsIgnoreCase(namespace)) {
|
||||
loadLocalVocabularySchema(provider, "Org.OData.Capabilities.V1", "Org.OData.Capabilities.V1.xml");
|
||||
} else if (namespace.equalsIgnoreCase("Org.OData.Measures.V1")) {
|
||||
} else if ("Org.OData.Measures.V1".equalsIgnoreCase(namespace)) {
|
||||
loadLocalVocabularySchema(provider, "Org.OData.Measures.V1", "Org.OData.Measures.V1.xml");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isCoreVocabulary(String namespace) {
|
||||
if(namespace.equalsIgnoreCase("Org.OData.Core.V1") ||
|
||||
namespace.equalsIgnoreCase("Org.OData.Capabilities.V1") ||
|
||||
namespace.equalsIgnoreCase("Org.OData.Measures.V1")) {
|
||||
if("Org.OData.Core.V1".equalsIgnoreCase(namespace) ||
|
||||
"Org.OData.Capabilities.V1".equalsIgnoreCase(namespace) ||
|
||||
"Org.OData.Measures.V1".equalsIgnoreCase(namespace)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -323,9 +323,9 @@ public class MetadataParser {
|
|||
@Override
|
||||
void build(XMLEventReader reader, StartElement element, SchemaBasedEdmProvider provider,
|
||||
String name) throws XMLStreamException {
|
||||
if (name.equals("DataServices")) {
|
||||
if ("DataServices".equals(name)) {
|
||||
readSchema(reader, element, provider);
|
||||
} else if (name.equals("Reference")) {
|
||||
} else if ("Reference".equals(name)) {
|
||||
readReference(reader, element, provider, "Reference");
|
||||
}
|
||||
}
|
||||
|
@ -345,17 +345,17 @@ public class MetadataParser {
|
|||
@Override
|
||||
void build(XMLEventReader reader, StartElement element,
|
||||
EdmxReference reference, String name) throws XMLStreamException {
|
||||
if (name.equals("Include")) {
|
||||
if ("Include".equals(name)) {
|
||||
EdmxReferenceInclude include = new EdmxReferenceInclude(attr(element, "Namespace"),
|
||||
attr(element, "Alias"));
|
||||
reference.addInclude(include);
|
||||
} else if (name.equals("IncludeAnnotations")) {
|
||||
} else if ("IncludeAnnotations".equals(name)) {
|
||||
EdmxReferenceIncludeAnnotation annotation = new EdmxReferenceIncludeAnnotation(
|
||||
attr(element, "TermNamespace"));
|
||||
annotation.setTargetNamespace(attr(element, "TargetNamespace"));
|
||||
annotation.setQualifier(attr(element, "Qualifier"));
|
||||
reference.addIncludeAnnotation(annotation);
|
||||
} else if (name.equals("Annotation")) {
|
||||
} else if ("Annotation".equals(name)) {
|
||||
readAnnotations(reader, element, reference);
|
||||
}
|
||||
}
|
||||
|
@ -391,25 +391,25 @@ public class MetadataParser {
|
|||
@Override
|
||||
void build(XMLEventReader reader, StartElement element, CsdlSchema schema, String name)
|
||||
throws XMLStreamException {
|
||||
if (name.equals("Action")) {
|
||||
if ("Action".equals(name)) {
|
||||
readAction(reader, element, schema);
|
||||
} else if (name.equals("Annotations")) {
|
||||
} else if ("Annotations".equals(name)) {
|
||||
readAnnotationGroup(reader, element, schema);
|
||||
} else if (name.equals("Annotation")) {
|
||||
} else if ("Annotation".equals(name)) {
|
||||
readAnnotations(reader, element, schema);
|
||||
} else if (name.equals("ComplexType")) {
|
||||
} else if ("ComplexType".equals(name)) {
|
||||
readComplexType(reader, element, schema);
|
||||
} else if (name.equals("EntityContainer")) {
|
||||
} else if ("EntityContainer".equals(name)) {
|
||||
readEntityContainer(reader, element, schema);
|
||||
} else if (name.equals("EntityType")) {
|
||||
} else if ("EntityType".equals(name)) {
|
||||
readEntityType(reader, element, schema);
|
||||
} else if (name.equals("EnumType")) {
|
||||
} else if ("EnumType".equals(name)) {
|
||||
readEnumType(reader, element, schema);
|
||||
} else if (name.equals("Function")) {
|
||||
} else if ("Function".equals(name)) {
|
||||
readFunction(reader, element, schema);
|
||||
} else if (name.equals("Term")) {
|
||||
} else if ("Term".equals(name)) {
|
||||
schema.getTerms().add(readTerm(reader, element));
|
||||
} else if (name.equals("TypeDefinition")) {
|
||||
} else if ("TypeDefinition".equals(name)) {
|
||||
schema.getTypeDefinitions().add(readTypeDefinition(reader, element));
|
||||
}
|
||||
}
|
||||
|
@ -593,7 +593,7 @@ public class MetadataParser {
|
|||
|
||||
if (event.isStartElement()) {
|
||||
StartElement element = event.asStartElement();
|
||||
if (element.getName().getLocalPart().equals("Annotation")) {
|
||||
if ("Annotation".equals(element.getName().getLocalPart())) {
|
||||
reader.nextEvent();
|
||||
readAnnotations(reader, element, edmObject);
|
||||
}
|
||||
|
@ -601,7 +601,7 @@ public class MetadataParser {
|
|||
|
||||
if (event.isEndElement()) {
|
||||
EndElement element = event.asEndElement();
|
||||
if (element.getName().getLocalPart().equals("Annotation")) {
|
||||
if ("Annotation".equals(element.getName().getLocalPart())) {
|
||||
reader.nextEvent();
|
||||
}
|
||||
|
||||
|
@ -668,7 +668,7 @@ public class MetadataParser {
|
|||
throws XMLStreamException {
|
||||
|
||||
// element based expressions
|
||||
if (!name.equals("Annotation")) {
|
||||
if (!"Annotation".equals(name)) {
|
||||
// attribute based expressions.
|
||||
readAttributeExpressions(element, target);
|
||||
|
||||
|
@ -680,59 +680,59 @@ public class MetadataParser {
|
|||
}
|
||||
}
|
||||
|
||||
if (name.equals("Collection")) {
|
||||
if ("Collection".equals(name)) {
|
||||
CsdlCollection expr = new CsdlCollection();
|
||||
readExpressions(reader, element, expr);
|
||||
write(target, expr);
|
||||
} else if (name.equals("AnnotationPath")) {
|
||||
} else if ("AnnotationPath".equals(name)) {
|
||||
write(target, new CsdlAnnotationPath().setValue(elementValue(reader, element)));
|
||||
} else if (name.equals("NavigationPropertyPath")) {
|
||||
} else if ("NavigationPropertyPath".equals(name)) {
|
||||
write(target, new CsdlNavigationPropertyPath()
|
||||
.setValue(elementValue(reader, element)));
|
||||
} else if (name.equals("Path")) {
|
||||
} else if ("Path".equals(name)) {
|
||||
write(target, new CsdlPath().setValue(elementValue(reader, element)));
|
||||
} else if (name.equals("PropertyPath")) {
|
||||
} else if ("PropertyPath".equals(name)) {
|
||||
write(target, new CsdlPropertyPath().setValue(elementValue(reader, element)));
|
||||
} else if (name.equals("UrlRef")) {
|
||||
} else if ("UrlRef".equals(name)) {
|
||||
CsdlUrlRef expr = new CsdlUrlRef();
|
||||
readExpressions(reader, element, expr);
|
||||
write(target, expr);
|
||||
} else if (name.equals("Apply")) {
|
||||
} else if ("Apply".equals(name)) {
|
||||
CsdlApply expr = new CsdlApply();
|
||||
expr.setFunction(attr(element, "Function"));
|
||||
readExpressions(reader, element, expr);
|
||||
write(target, expr);
|
||||
} else if (name.equals("Cast")) {
|
||||
} else if ("Cast".equals(name)) {
|
||||
CsdlCast expr = new CsdlCast();
|
||||
expr.setType(attr(element, "Type"));
|
||||
readExpressions(reader, element, expr);
|
||||
write(target, expr);
|
||||
} else if (name.equals("If")) {
|
||||
} else if ("If".equals(name)) {
|
||||
CsdlIf expr = new CsdlIf();
|
||||
readExpressions(reader, element, expr);
|
||||
write(target, expr);
|
||||
} else if (name.equals("IsOf")) {
|
||||
} else if ("IsOf".equals(name)) {
|
||||
CsdlIsOf expr = new CsdlIsOf();
|
||||
expr.setType(attr(element, "Type"));
|
||||
readExpressions(reader, element, expr);
|
||||
write(target, expr);
|
||||
} else if (name.equals("LabeledElement")) {
|
||||
} else if ("LabeledElement".equals(name)) {
|
||||
CsdlLabeledElement expr = new CsdlLabeledElement();
|
||||
expr.setName(attr(element, "Name"));
|
||||
readExpressions(reader, element, expr);
|
||||
write(target, expr);
|
||||
} else if (name.equals("LabeledElementReference")) {
|
||||
} else if ("LabeledElementReference".equals(name)) {
|
||||
CsdlLabeledElementReference expr = new CsdlLabeledElementReference();
|
||||
expr.setValue(elementValue(reader, element));
|
||||
write(target, expr);
|
||||
} else if (name.equals("Null")) {
|
||||
} else if ("Null".equals(name)) {
|
||||
write(target, new CsdlNull());
|
||||
} else if (name.equals("Record")) {
|
||||
} else if ("Record".equals(name)) {
|
||||
CsdlRecord expr = new CsdlRecord();
|
||||
expr.setType(attr(element, "Type"));
|
||||
readPropertyValues(reader, element, expr);
|
||||
write(target, expr);
|
||||
} else if (name.equals("Annotation")) {
|
||||
} else if ("Annotation".equals(name)) {
|
||||
readAnnotations(reader, element, (CsdlAnnotatable)target);
|
||||
}
|
||||
}
|
||||
|
@ -796,13 +796,13 @@ public class MetadataParser {
|
|||
@Override
|
||||
void build(XMLEventReader reader, StartElement element, CsdlRecord record, String name)
|
||||
throws XMLStreamException {
|
||||
if (name.equals("PropertyValue")) {
|
||||
if ("PropertyValue".equals(name)) {
|
||||
CsdlPropertyValue value = new CsdlPropertyValue();
|
||||
value.setProperty(attr(element, "Property"));
|
||||
readAttributeExpressions(element, value);
|
||||
readExpressions(reader, element, value);
|
||||
record.getPropertyValues().add(value);
|
||||
} else if (name.equals("Annotation")) {
|
||||
} else if ("Annotation".equals(name)) {
|
||||
readAnnotations(reader, element, record);
|
||||
}
|
||||
}
|
||||
|
@ -831,11 +831,11 @@ public class MetadataParser {
|
|||
@Override
|
||||
void build(XMLEventReader reader, StartElement element, CsdlOperation operation, String name)
|
||||
throws XMLStreamException {
|
||||
if (name.equals("Parameter")) {
|
||||
if ("Parameter".equals(name)) {
|
||||
readParameter(reader, element, operation);
|
||||
} else if (name.equals("ReturnType")) {
|
||||
} else if ("ReturnType".equals(name)) {
|
||||
readReturnType(reader, element, operation);
|
||||
} else if (name.equals("Annotation")) {
|
||||
} else if ("Annotation".equals(name)) {
|
||||
readAnnotations(reader, element, operation);
|
||||
}
|
||||
}
|
||||
|
@ -863,13 +863,13 @@ public class MetadataParser {
|
|||
@Override
|
||||
void build(XMLEventReader reader, StartElement element, CsdlEnumType type, String name)
|
||||
throws XMLStreamException {
|
||||
if (name.equals("Member")) {
|
||||
if ("Member".equals(name)) {
|
||||
CsdlEnumMember member = new CsdlEnumMember();
|
||||
member.setName(attr(element, "Name"));
|
||||
member.setValue(attr(element, "Value"));
|
||||
peekAnnotations(reader, name, member);
|
||||
type.getMembers().add(member);
|
||||
} else if (name.equals("Annotation")) {
|
||||
} else if ("Annotation".equals(name)) {
|
||||
readAnnotations(reader, element, type);
|
||||
}
|
||||
}
|
||||
|
@ -899,13 +899,13 @@ public class MetadataParser {
|
|||
@Override
|
||||
void build(XMLEventReader reader, StartElement element, CsdlEntityType entityType, String name)
|
||||
throws XMLStreamException {
|
||||
if (name.equals("Property")) {
|
||||
if ("Property".equals(name)) {
|
||||
entityType.getProperties().add(readProperty(reader, element));
|
||||
} else if (name.equals("NavigationProperty")) {
|
||||
} else if ("NavigationProperty".equals(name)) {
|
||||
entityType.getNavigationProperties().add(readNavigationProperty(reader, element));
|
||||
} else if (name.equals("Key")) {
|
||||
} else if ("Key".equals(name)) {
|
||||
readKey(reader, element, entityType);
|
||||
} else if (name.equals("Annotation")) {
|
||||
} else if ("Annotation".equals(name)) {
|
||||
readAnnotations(reader, element, entityType);
|
||||
}
|
||||
}
|
||||
|
@ -942,18 +942,18 @@ public class MetadataParser {
|
|||
@Override
|
||||
void build(XMLEventReader reader, StartElement element, CsdlNavigationProperty property,
|
||||
String name) throws XMLStreamException {
|
||||
if (name.equals("ReferentialConstraint")) {
|
||||
if ("ReferentialConstraint".equals(name)) {
|
||||
CsdlReferentialConstraint constraint = new CsdlReferentialConstraint();
|
||||
constraint.setProperty(attr(element, "Property"));
|
||||
constraint.setReferencedProperty(attr(element, "ReferencedProperty"));
|
||||
peekAnnotations(reader, name, constraint);
|
||||
property.getReferentialConstraints().add(constraint);
|
||||
} else if (name.equals("OnDelete")) {
|
||||
} else if ("OnDelete".equals(name)) {
|
||||
CsdlOnDelete delete = new CsdlOnDelete();
|
||||
delete.setAction(CsdlOnDeleteAction.valueOf(attr(element, "Action")));
|
||||
property.setOnDelete(delete);
|
||||
peekAnnotations(reader, name, delete);
|
||||
} else if (name.equals("Annotation")) {
|
||||
} else if ("Annotation".equals(name)) {
|
||||
readAnnotations(reader, element, property);
|
||||
}
|
||||
}
|
||||
|
@ -1029,15 +1029,15 @@ public class MetadataParser {
|
|||
@Override
|
||||
void build(XMLEventReader reader, StartElement element, CsdlSchema schema, String name)
|
||||
throws XMLStreamException {
|
||||
if (name.equals("EntitySet")) {
|
||||
if ("EntitySet".equals(name)) {
|
||||
readEntitySet(reader, element, container);
|
||||
} else if (name.equals("Singleton")) {
|
||||
} else if ("Singleton".equals(name)) {
|
||||
readSingleton(reader, element, container);
|
||||
} else if (name.equals("ActionImport")) {
|
||||
} else if ("ActionImport".equals(name)) {
|
||||
readActionImport(reader, element, container);
|
||||
} else if (name.equals("FunctionImport")) {
|
||||
} else if ("FunctionImport".equals(name)) {
|
||||
readFunctionImport(reader, element, container);
|
||||
} else if (name.equals("Annotation")) {
|
||||
} else if ("Annotation".equals(name)) {
|
||||
readAnnotations(reader, element, container);
|
||||
}
|
||||
}
|
||||
|
@ -1103,12 +1103,12 @@ public class MetadataParser {
|
|||
@Override
|
||||
void build(XMLEventReader reader, StartElement element,
|
||||
CsdlBindingTarget entitySet, String name) throws XMLStreamException {
|
||||
if (name.equals("NavigationPropertyBinding")) {
|
||||
if ("NavigationPropertyBinding".equals(name)) {
|
||||
CsdlNavigationPropertyBinding binding = new CsdlNavigationPropertyBinding();
|
||||
binding.setPath(attr(element, "Path"));
|
||||
binding.setTarget(attr(element, "Target"));
|
||||
entitySet.getNavigationPropertyBindings().add(binding);
|
||||
} else if (name.equals("Annotation")) {
|
||||
} else if ("Annotation".equals(name)) {
|
||||
readAnnotations(reader, element, entitySet);
|
||||
}
|
||||
}
|
||||
|
@ -1141,11 +1141,11 @@ public class MetadataParser {
|
|||
@Override
|
||||
void build(XMLEventReader reader, StartElement element, CsdlComplexType complexType, String name)
|
||||
throws XMLStreamException {
|
||||
if (name.equals("Property")) {
|
||||
if ("Property".equals(name)) {
|
||||
complexType.getProperties().add(readProperty(reader, element));
|
||||
} else if (name.equals("NavigationProperty")) {
|
||||
} else if ("NavigationProperty".equals(name)) {
|
||||
complexType.getNavigationProperties().add(readNavigationProperty(reader, element));
|
||||
} else if (name.equals("Annotation")) {
|
||||
} else if ("Annotation".equals(name)) {
|
||||
readAnnotations(reader, element, complexType);
|
||||
}
|
||||
}
|
||||
|
@ -1212,13 +1212,13 @@ public class MetadataParser {
|
|||
while (reader.hasNext()) {
|
||||
if (event.isStartElement()) {
|
||||
StartElement element = event.asStartElement();
|
||||
if (element.getName().getLocalPart().equals("Annotation")) {
|
||||
if ("Annotation".equals(element.getName().getLocalPart())) {
|
||||
skip = true;
|
||||
}
|
||||
}
|
||||
if (event.isEndElement()) {
|
||||
EndElement element = event.asEndElement();
|
||||
if (element.getName().getLocalPart().equals("Annotation")) {
|
||||
if ("Annotation".equals(element.getName().getLocalPart())) {
|
||||
return reader.peek();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,9 +106,9 @@ public class ServiceDispatcher extends RequestURLHierarchyVisitor {
|
|||
|
||||
protected void handleException(ODataException e, ContentType contentType,
|
||||
ODataRequest odRequest, ODataResponse odResponse) {
|
||||
ErrorHandler handler = new ErrorHandler(this.odata, this.metadata,
|
||||
ErrorHandler errorHandler = new ErrorHandler(this.odata, this.metadata,
|
||||
this.handler, contentType);
|
||||
handler.handleException(e, odRequest, odResponse);
|
||||
errorHandler.handleException(e, odRequest, odResponse);
|
||||
}
|
||||
|
||||
private void internalExecute(UriInfo uriInfo, ODataRequest odRequest,
|
||||
|
@ -119,7 +119,7 @@ public class ServiceDispatcher extends RequestURLHierarchyVisitor {
|
|||
|
||||
// part1, 8.2.6
|
||||
String isolation = odRequest.getHeader(HttpHeader.ODATA_ISOLATION);
|
||||
if (isolation != null && isolation.equals("snapshot") && !this.handler.supportsDataIsolation()) {
|
||||
if (isolation != null && "snapshot".equals(isolation) && !this.handler.supportsDataIsolation()) {
|
||||
odResponse.setStatusCode(HttpStatusCode.PRECONDITION_FAILED.getStatusCode());
|
||||
return;
|
||||
}
|
||||
|
@ -255,17 +255,6 @@ public class ServiceDispatcher extends RequestURLHierarchyVisitor {
|
|||
public void visit(UriInfoEntityId info) {
|
||||
DataRequest dataRequest = new DataRequest(this.odata, this.metadata);
|
||||
this.request = dataRequest;
|
||||
|
||||
/*
|
||||
// this can relative or absolute form
|
||||
String id = info.getIdOption().getValue();
|
||||
try {
|
||||
URL url = new URL(id);
|
||||
this.idOption = url.getPath();
|
||||
} catch (MalformedURLException e) {
|
||||
this.idOption = id;
|
||||
}
|
||||
*/
|
||||
super.visit(info);
|
||||
}
|
||||
|
||||
|
|
|
@ -340,11 +340,11 @@ public abstract class ServiceRequest {
|
|||
rawPath = rawPath.substring(e+path.length());
|
||||
}
|
||||
|
||||
UriInfo uriInfo = new Parser(serviceMetadata.getEdm(), odata).parseUri(rawPath, uri.getQuery(), null,
|
||||
UriInfo reqUriInfo = new Parser(serviceMetadata.getEdm(), odata).parseUri(rawPath, uri.getQuery(), null,
|
||||
getODataRequest().getRawBaseUri());
|
||||
ServiceDispatcher dispatcher = new ServiceDispatcher(odata, serviceMetadata, null, customContentType);
|
||||
dispatcher.visit(uriInfo);
|
||||
dispatcher.request.setUriInfo(uriInfo);
|
||||
dispatcher.visit(reqUriInfo);
|
||||
dispatcher.request.setUriInfo(reqUriInfo);
|
||||
return (DataRequest)dispatcher.request;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -216,16 +216,6 @@ public class DataRequest extends ServiceRequest {
|
|||
return valueRequest;
|
||||
}
|
||||
|
||||
/*
|
||||
private boolean hasMediaStream() {
|
||||
return this.uriResourceEntitySet != null && this.uriResourceEntitySet.getEntityType().hasStream();
|
||||
}
|
||||
|
||||
private InputStream getMediaStream() {
|
||||
return this.request.getBody();
|
||||
}
|
||||
*/
|
||||
|
||||
public void setValueRequest(boolean valueRequest) {
|
||||
this.valueRequest = valueRequest;
|
||||
this.type = new ValueRequest();
|
||||
|
@ -340,7 +330,7 @@ public class DataRequest extends ServiceRequest {
|
|||
// by this specification.
|
||||
boolean ifMatch = getHeader(HttpHeader.IF_MATCH) != null;
|
||||
boolean ifNoneMatch = (getHeader(HttpHeader.IF_NONE_MATCH)!= null
|
||||
&& getHeader(HttpHeader.IF_NONE_MATCH).equals("*"));
|
||||
&& "*".equals(getHeader(HttpHeader.IF_NONE_MATCH)));
|
||||
if(ifMatch) {
|
||||
handler.updateEntity(DataRequest.this, getEntityFromClient(), isPATCH(), getETag(),
|
||||
entityResponse);
|
||||
|
@ -620,8 +610,8 @@ public class DataRequest extends ServiceRequest {
|
|||
builder.navOrPropertyPath(edmProperty.getName());
|
||||
}
|
||||
if (isPropertyComplex()) {
|
||||
EdmComplexType type = ((UriResourceComplexProperty) uriResourceProperty).getComplexType();
|
||||
String select = helper.buildContextURLSelectList(type, getUriInfo().getExpandOption(),
|
||||
EdmComplexType complexType = ((UriResourceComplexProperty) uriResourceProperty).getComplexType();
|
||||
String select = helper.buildContextURLSelectList(complexType, getUriInfo().getExpandOption(),
|
||||
getUriInfo().getSelectOption());
|
||||
builder.selectList(select);
|
||||
}
|
||||
|
|
|
@ -73,9 +73,7 @@ public abstract class OperationRequest extends ServiceRequest {
|
|||
if (!hasReturnType()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
//final UriHelper helper = odata.createUriHelper();
|
||||
|
||||
|
||||
if (isReturnTypePrimitive() || isReturnTypeComplex()) {
|
||||
// Part 1 {10.14, 10.14} since the function return properties does not
|
||||
// represent a Entity property
|
||||
|
@ -86,18 +84,6 @@ public abstract class OperationRequest extends ServiceRequest {
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
/*
|
||||
// EdmTypeKind.ENTITY;
|
||||
if (isBound()) {
|
||||
// Bound means, we know the EnitySet of the return type. Part 1 {10.2,
|
||||
// 10.3}
|
||||
EdmEntitySet entitySet = this.uriResourceFunction.getFunctionImport().getReturnedEntitySet();
|
||||
ContextURL.Builder builder = DataRequest.buildEntitySetContextURL(helper, entitySet,
|
||||
this.uriInfo, isCollection(), false);
|
||||
return builder.build();
|
||||
}
|
||||
*/
|
||||
|
||||
// EdmTypeKind.ENTITY; Not Bound
|
||||
// Here we do not know the EntitySet, then follow directions from
|
||||
// Part-1{10.2. 10.3} to use
|
||||
|
|
|
@ -46,7 +46,7 @@ public class BatchQueryOperation implements BatchPart {
|
|||
}
|
||||
|
||||
protected Line consumeHttpStatusLine(final List<Line> message) throws BatchDeserializerException {
|
||||
if (!message.isEmpty() && !message.get(0).toString().trim().equals("")) {
|
||||
if (!message.isEmpty() && !"".equals(message.get(0).toString().trim())) {
|
||||
final Line method = message.get(0);
|
||||
message.remove(0);
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public class ETagHelperImpl implements ETagHelper {
|
|||
*/
|
||||
protected ETagInformation createETagInformation(final Collection<String> values) {
|
||||
final Collection<String> eTags = ETagParser.parse(values);
|
||||
final boolean isAll = eTags.size() == 1 && eTags.iterator().next().equals("*");
|
||||
final boolean isAll = eTags.size() == 1 && "*".equals(eTags.iterator().next());
|
||||
return new ETagInformation(isAll,
|
||||
isAll ? Collections.<String> emptySet() : Collections.unmodifiableCollection(eTags));
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public class ETagParser {
|
|||
Set<String> result = new HashSet<String>();
|
||||
for (final String value : values) {
|
||||
final Collection<String> part = parse(value);
|
||||
if (part.size() == 1 && part.iterator().next().equals("*")) {
|
||||
if (part.size() == 1 && "*".equals(part.iterator().next())) {
|
||||
return part;
|
||||
} else {
|
||||
result.addAll(part);
|
||||
|
@ -66,7 +66,7 @@ public class ETagParser {
|
|||
}
|
||||
|
||||
private static Collection<String> parse(final String value) {
|
||||
if (value.trim().equals("*")) {
|
||||
if ("*".equals(value.trim())) {
|
||||
return Collections.singleton("*");
|
||||
} else {
|
||||
Set<String> result = new HashSet<String>();
|
||||
|
|
|
@ -142,21 +142,21 @@ public class Parser {
|
|||
ensureLastSegment(firstSegment, 1, numberOfSegments);
|
||||
contextUriInfo.setKind(UriInfoKind.service);
|
||||
|
||||
} else if (firstSegment.equals("$batch")) {
|
||||
} else if ("$batch".equals(firstSegment)) {
|
||||
ensureLastSegment(firstSegment, 1, numberOfSegments);
|
||||
contextUriInfo.setKind(UriInfoKind.batch);
|
||||
|
||||
} else if (firstSegment.equals("$metadata")) {
|
||||
} else if ("$metadata".equals(firstSegment)) {
|
||||
ensureLastSegment(firstSegment, 1, numberOfSegments);
|
||||
contextUriInfo.setKind(UriInfoKind.metadata);
|
||||
contextUriInfo.setFragment(fragment);
|
||||
|
||||
} else if (firstSegment.equals("$all")) {
|
||||
} else if ("$all".equals(firstSegment)) {
|
||||
ensureLastSegment(firstSegment, 1, numberOfSegments);
|
||||
contextUriInfo.setKind(UriInfoKind.all);
|
||||
contextIsCollection = true;
|
||||
|
||||
} else if (firstSegment.equals("$entity")) {
|
||||
} else if ("$entity".equals(firstSegment)) {
|
||||
if (null != contextUriInfo.getIdOption()) {
|
||||
String idOptionText = contextUriInfo.getIdOption().getText();
|
||||
if (idOptionText.startsWith(HTTP)) {
|
||||
|
@ -317,7 +317,7 @@ public class Parser {
|
|||
systemOption = new FilterOptionImpl();
|
||||
break;
|
||||
case COUNT:
|
||||
if (optionValue.equals("true") || optionValue.equals("false")) {
|
||||
if ("true".equals(optionValue) || "false".equals(optionValue)) {
|
||||
systemOption = new CountOptionImpl().setValue(Boolean.parseBoolean(optionValue));
|
||||
} else {
|
||||
throw new UriParserSyntaxException("Illegal value of $count option!",
|
||||
|
|
Loading…
Reference in New Issue