本文整理汇总了Java中org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty类的典型用法代码示例。如果您正苦于以下问题:Java UriResourcePrimitiveProperty类的具体用法?Java UriResourcePrimitiveProperty怎么用?Java UriResourcePrimitiveProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UriResourcePrimitiveProperty类属于org.apache.olingo.server.api.uri包,在下文中一共展示了UriResourcePrimitiveProperty类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: toSort
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
/**
* Converts {@link OrderByItem} to {@link Sort} needed for
* {@link Pagination}.
*
* @param orderByItem
* order by item
* @return sort instance, or null in case order by item wasn't specific type
*/
protected Sort toSort(OrderByItem orderByItem) {
Expression expression = orderByItem.getExpression();
if (expression instanceof Member) {
UriInfoResource resourcePath = ((Member) expression).getResourcePath();
UriResource uriResource = resourcePath.getUriResourceParts().get(0);
if (uriResource instanceof UriResourcePrimitiveProperty) {
EdmProperty edmProperty = ((UriResourcePrimitiveProperty) uriResource)
.getProperty();
String property = edmProperty.getName();
if (edmProperty instanceof ElasticEdmProperty) {
ElasticEdmProperty entityTypeProperty = (ElasticEdmProperty) edmProperty;
property = addKeywordIfNeeded(entityTypeProperty.getEField(),
entityTypeProperty.getAnnotations());
}
return new Sort(property,
orderByItem.isDescending() ? Sort.Direction.DESC : Sort.Direction.ASC);
}
}
return null;
}
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:29,代码来源:RequestCreator.java
示例2: updatePrimitiveValue
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
public static void updatePrimitiveValue(RdfEdmProvider rdfEdmProvider, UriInfo uriInfo, Object entry)
throws OData2SparqlException {
SparqlStatement sparqlStatement = null;
// 1. Retrieve the entity set which belongs to the requested entity
List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
// Note: only in our example we can assume that the first segment is the EntitySet
UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0);
EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();
RdfEntityType entityType = rdfEdmProvider.getRdfEntityTypefromEdmEntitySet(edmEntitySet);
List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();
UriResourcePrimitiveProperty uriResourcePrimitiveProperty = (UriResourcePrimitiveProperty) resourcePaths.get(1);
EdmProperty edmProperty = uriResourcePrimitiveProperty.getProperty();
SparqlCreateUpdateDeleteBuilder sparqlCreateUpdateDeleteBuilder = new SparqlCreateUpdateDeleteBuilder(
rdfEdmProvider);
try {
sparqlStatement = sparqlCreateUpdateDeleteBuilder.generateUpdateEntitySimplePropertyValue(entityType,
keyPredicates, edmProperty.getName(), entry);
} catch (Exception e) {
log.error(e.getMessage());
throw new OData2SparqlException(e.getMessage());
}
sparqlStatement.executeUpdate(rdfEdmProvider);
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:27,代码来源:SparqlBaseCommand.java
示例3: collectPathToMember
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
/**
* Collects path to member. This path is helpful for complex lambdas, like
* this one: $filter=info/pages/any(p:p/words/any(w:w eq 'word')) We need to
* store this path manually because Member inside lambda doesn't contain
* full path to itself.
*
* @param parentPath
* path to parent member
* @return path to current member
*/
private String collectPathToMember(String parentPath) {
String parentPathPrefix = parentPath != null ? parentPath : "";
List<String> resourceNames = null;
if (resourceParts.size() > 1) {
// we need only parts that shows path to property
// the last part is either lambda or name of the property we want to
// filter by, so we ignore it
resourceNames = resourceParts.subList(0, resourceParts.size() - 1).stream()
.filter(resource -> resource instanceof UriResourceComplexProperty
|| resource instanceof UriResourcePrimitiveProperty)
.map(part -> ((UriResourceProperty) part).getProperty().getName())
.collect(Collectors.toList());
}
boolean namesListIsNotEmpty = resourceNames != null && !resourceNames.isEmpty();
if (namesListIsNotEmpty && !parentPathPrefix.isEmpty()) {
parentPathPrefix += NESTED_PATH_SEPARATOR;
}
return namesListIsNotEmpty
? parentPathPrefix + String.join(NESTED_PATH_SEPARATOR, resourceNames) : parentPath;
}
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:33,代码来源:MemberHandler.java
示例4: handleCountDispatching
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
private void handleCountDispatching(final ODataRequest request, final ODataResponse response,
final int lastPathSegmentIndex) throws ODataApplicationException, ODataLibraryException {
final UriResource resource = uriInfo.getUriResourceParts().get(lastPathSegmentIndex - 1);
if (resource instanceof UriResourceEntitySet
|| resource instanceof UriResourceNavigation
|| resource instanceof UriResourceFunction
&& ((UriResourceFunction) resource).getType().getKind() == EdmTypeKind.ENTITY) {
handler.selectProcessor(CountEntityCollectionProcessor.class)
.countEntityCollection(request, response, uriInfo);
} else if (resource instanceof UriResourcePrimitiveProperty
|| resource instanceof UriResourceFunction
&& ((UriResourceFunction) resource).getType().getKind() == EdmTypeKind.PRIMITIVE) {
handler.selectProcessor(CountPrimitiveCollectionProcessor.class)
.countPrimitiveCollection(request, response, uriInfo);
} else {
handler.selectProcessor(CountComplexCollectionProcessor.class)
.countComplexCollection(request, response, uriInfo);
}
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:20,代码来源:ODataDispatcher.java
示例5: visitMember
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
@Override
public Object visitMember(final Member member) throws ExpressionVisitException, ODataApplicationException {
// To keeps things simple, this tutorial allows only primitive properties.
// We have faith that the java type of Edm.Int32 is Integer
final List<UriResource> uriResourceParts = member.getResourcePath().getUriResourceParts();
// Make sure that the resource path of the property contains only a single segment and a primitive property
// has been addressed. We can be sure, that the property exists because the UriParser checks if the
// property has been defined in service metadata document.
if(uriResourceParts.size() == 1 && uriResourceParts.get(0) instanceof UriResourcePrimitiveProperty) {
UriResourcePrimitiveProperty uriResourceProperty = (UriResourcePrimitiveProperty) uriResourceParts.get(0);
return currentEntity.getProperty(uriResourceProperty.getProperty().getName()).getValue();
} else {
// The OData specification allows in addition complex properties and navigation properties
// with a target cardinality 0..1 or 1.
// This means any combination can occur e.g. Supplier/Address/City
// -> Navigation properties Supplier
// -> Complex Property Address
// -> Primitive Property City
// For such cases the resource path returns a list of UriResourceParts
throw new ODataApplicationException("Only primitive properties are implemented in filter expressions",
HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
}
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:FilterExpressionVisitor.java
示例6: visitMember
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
public Object visitMember(final Member member) throws ExpressionVisitException, ODataApplicationException {
// To keeps things simple, this tutorial allows only primitive properties.
// We have faith that the java type of Edm.Int32 is Integer
final List<UriResource> uriResourceParts = member.getResourcePath().getUriResourceParts();
// Make sure that the resource path of the property contains only a single segment and a primitive property
// has been addressed. We can be sure, that the property exists because the UriParser checks if the
// property has been defined in service metadata document.
if(uriResourceParts.size() == 1 && uriResourceParts.get(0) instanceof UriResourcePrimitiveProperty) {
UriResourcePrimitiveProperty uriResourceProperty = (UriResourcePrimitiveProperty) uriResourceParts.get(0);
return currentEntity.getProperty(uriResourceProperty.getProperty().getName()).getValue();
} else {
// The OData specification allows in addition complex properties and navigation properties
// with a target cardinality 0..1 or 1.
// This means any combination can occur e.g. Supplier/Address/City
// -> Navigation properties Supplier
// -> Complex Property Address
// -> Primitive Property City
// For such cases the resource path returns a list of UriResourceParts
throw new ODataApplicationException("Only primitive properties are implemented in filter expressions",
HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
}
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:26,代码来源:FilterExpressionVisitor.java
示例7: visitMember
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
@Override
public SQLExpression visitMember(Member member) throws ExpressionVisitException, ODataApplicationException {
final List<UriResource> uriResourceParts = member.getResourcePath().getUriResourceParts();
if(uriResourceParts.size() == 1 && uriResourceParts.get(0) instanceof UriResourcePrimitiveProperty) {
UriResourcePrimitiveProperty uriResourceProperty = (UriResourcePrimitiveProperty) uriResourceParts.get(0);
String name = uriResourceProperty.getProperty().getName();
Table table = new Table().setName(alias);
return new Column(alias != null ? table : null , name);
} else {
throw new ODataApplicationException("Only primitive properties are implemented in filter expressions",
HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
}
}
开发者ID:jbaliuka,项目名称:sql-analytic,代码行数:19,代码来源:FilterExpressionVisitor.java
示例8: updatePrimitive
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
@Override
public void updatePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo,
ContentType requestFormat, ContentType responseFormat)
throws ODataApplicationException, ODataLibraryException {
// 1. Retrieve the entity set which belongs to the requested entity
List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
UriResourcePrimitiveProperty uriResourcePrimitiveProperty = (UriResourcePrimitiveProperty) resourcePaths.get(1);
EdmProperty edmProperty = uriResourcePrimitiveProperty.getProperty();
InputStream requestInputStream = request.getBody();
ODataDeserializer deserializer = this.odata.createDeserializer(requestFormat);
DeserializerResult result = deserializer.property(requestInputStream, edmProperty);
//TODO we need to better handle different formats of the object provided
this.updatePrimitiveOrValue(request, response, uriInfo, result.getProperty().getValue().toString(), false);
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:16,代码来源:SparqlPrimitiveValueProcessor.java
示例9: updatePrimitiveValue
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
@Override
public void updatePrimitiveValue(ODataRequest request, ODataResponse response, UriInfo uriInfo,
ContentType requestFormat, ContentType responseFormat)
throws ODataApplicationException, ODataLibraryException {
// 1. Retrieve the entity set which belongs to the requested entity
List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
UriResourcePrimitiveProperty uriResourcePrimitiveProperty = (UriResourcePrimitiveProperty) resourcePaths.get(1);
EdmProperty edmProperty = uriResourcePrimitiveProperty.getProperty();
InputStream requestInputStream = request.getBody();
FixedFormatDeserializer deserializer = this.odata.createFixedFormatDeserializer();
Object result = deserializer.primitiveValue(requestInputStream, edmProperty);
this.updatePrimitiveOrValue(request, response, uriInfo, result, true);
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:16,代码来源:SparqlPrimitiveValueProcessor.java
示例10: deletePrimitiveValue
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
public static void deletePrimitiveValue(RdfEdmProvider rdfEdmProvider, UriInfo uriInfo)
throws OData2SparqlException {
SparqlStatement sparqlStatement = null;
// 1. Retrieve the entity set which belongs to the requested entity
List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
// Note: only in our example we can assume that the first segment is the EntitySet
UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0);
EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();
RdfEntityType entityType = rdfEdmProvider.getRdfEntityTypefromEdmEntitySet(edmEntitySet);
List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();
UriResourcePrimitiveProperty uriResourcePrimitiveProperty = (UriResourcePrimitiveProperty) resourcePaths.get(1);
EdmProperty edmProperty = uriResourcePrimitiveProperty.getProperty();
SparqlCreateUpdateDeleteBuilder sparqlCreateUpdateDeleteBuilder = new SparqlCreateUpdateDeleteBuilder(
rdfEdmProvider);
try {
sparqlStatement = sparqlCreateUpdateDeleteBuilder.generateDeleteEntitySimplePropertyValue(entityType,
keyPredicates, edmProperty.getName());
} catch (Exception e) {
log.error(e.getMessage());
throw new OData2SparqlException(e.getMessage());
}
sparqlStatement.executeDelete(rdfEdmProvider);
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:28,代码来源:SparqlBaseCommand.java
示例11: handle
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
/**
* Processes raw olingo expression member.
*
* @param collectionResourceCache
* cache with parent members collection resources. Used for
* nested lambdas
* @return expression member
* @throws ODataApplicationException
* OData app exception
* @throws ExpressionVisitException
* expression visitor exception
*/
public ExpressionMember handle(Map<String, UriResource> collectionResourceCache)
throws ODataApplicationException, ExpressionVisitException {
this.collectionResourceCache = collectionResourceCache;
if (lastPart instanceof UriResourceLambdaAll) {
return throwNotImplemented("All lambda is not implemented");
} else if (lastPart instanceof UriResourceLambdaAny) {
return handleLambdaAny();
} else if (lastPart instanceof UriResourcePrimitiveProperty
|| lastPart instanceof UriResourceLambdaVariable) {
return handlePrimitive();
} else {
return throwNotImplemented();
}
}
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:27,代码来源:MemberHandler.java
示例12: visitMember
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
@Override
public Object visitMember(UriInfoResource uriInfoResource) throws ExpressionVisitException, ODataApplicationException {
List<UriResource> uriResourceParts = uriInfoResource.getUriResourceParts();
if(uriResourceParts.size() == 1 && uriResourceParts.get(0) instanceof UriResourcePrimitiveProperty) {
UriResourcePrimitiveProperty uriResourcePrimitiveProperty = (UriResourcePrimitiveProperty) uriResourceParts.get(0);
return entity.getProperty(uriResourcePrimitiveProperty.getProperty().getName()).getValue();
}
else {
throw new ODataApplicationException("Only primitive properties are implemented in filter expressions", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
}
}
开发者ID:sbcd90,项目名称:olingo-jersey,代码行数:13,代码来源:FilterExpressionVisitor.java
示例13: visit
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
@Override
public void visit(UriResourcePrimitiveProperty info) {
if (info.isCollection()) {
this.entitySet = "Collection("+info.getProperty().getType().toString()+")"; //$NON-NLS-1$ //$NON-NLS-2$
}
this.entitySet = info.getProperty().getType().toString();
this.navPath = null;
}
开发者ID:kenweezy,项目名称:teiid,代码行数:9,代码来源:ContextURLHelper.java
示例14: visit
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
@Override
public void visit(SelectOption option) {
if (this.selectionComplete) {
return;
}
if (option == null) {
// default select columns
addAllColumns();
}
else {
for (SelectItem si:option.getSelectItems()) {
if (si.isStar()) {
addAllColumns();
continue;
}
UriResource resource = ResourcePropertyCollector.getUriResource(si.getResourcePath());
if (resource.getKind() != UriResourceKind.primitiveProperty) {
this.exceptions.add(new TeiidException(ODataPlugin.Event.TEIID16025, ODataPlugin.Util.gs(ODataPlugin.Event.TEIID16025)));
continue;
}
UriResourcePrimitiveProperty primitiveProp = (UriResourcePrimitiveProperty)resource;
addSelectColumn(new ElementSymbol(primitiveProp.getProperty().getName(), this.edmEntityTableGroup));
}
}
}
开发者ID:kenweezy,项目名称:teiid,代码行数:28,代码来源:ODataSQLBuilder.java
示例15: isPropertyStream
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
public boolean isPropertyStream() {
if (isPropertyComplex()) {
return false;
}
EdmProperty property = ((UriResourcePrimitiveProperty)this.uriResourceProperty).getProperty();
return property.getType() == odata.createPrimitiveTypeInstance(EdmPrimitiveTypeKind.Stream);
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:8,代码来源:DataRequest.java
示例16: visit
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
@Override
public void visit(UriResourcePrimitiveProperty info) {
}
开发者ID:kenweezy,项目名称:teiid,代码行数:4,代码来源:DefaultODataResourceURLHierarchyVisitor.java
示例17: visit
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
@Override
public void visit(UriResourcePrimitiveProperty info) {
this.resource = info;
}
开发者ID:kenweezy,项目名称:teiid,代码行数:5,代码来源:ResourcePropertyCollector.java
示例18: visit
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
@Override
public void visit(UriResourcePrimitiveProperty info) {
DataRequest dataRequest = (DataRequest) this.request;
dataRequest.setUriResourceProperty(info);
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:6,代码来源:ServiceDispatcher.java
示例19: readEntityCollection
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
public void readEntityCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo,
ContentType responseFormat) throws ODataApplicationException, SerializerException {
// 1st retrieve the requested EntitySet from the uriInfo (representation of the parsed URI)
List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
// in our example, the first segment is the EntitySet
UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0);
EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();
// 2nd: fetch the data from backend for this requested EntitySetName and deliver as EntitySet
EntityCollection entityCollection = storage.readEntitySetData(edmEntitySet);
List<Entity> entityList = entityCollection.getEntities();
// 3rd apply $orderby
OrderByOption orderByOption = uriInfo.getOrderByOption();
if (orderByOption != null) {
List<OrderByItem> orderItemList = orderByOption.getOrders();
final OrderByItem orderByItem = orderItemList.get(0); // in our example we support only one
Expression expression = orderByItem.getExpression();
if(expression instanceof Member){
UriInfoResource resourcePath = ((Member)expression).getResourcePath();
UriResource uriResource = resourcePath.getUriResourceParts().get(0);
if (uriResource instanceof UriResourcePrimitiveProperty) {
EdmProperty edmProperty = ((UriResourcePrimitiveProperty)uriResource).getProperty();
final String sortPropertyName = edmProperty.getName();
// do the sorting for the list of entities
Collections.sort(entityList, new Comparator<Entity>() {
// we delegate the sorting to the native sorter of Integer and String
public int compare(Entity entity1, Entity entity2) {
int compareResult = 0;
if(sortPropertyName.equals("ID")){
Integer integer1 = (Integer) entity1.getProperty(sortPropertyName).getValue();
Integer integer2 = (Integer) entity2.getProperty(sortPropertyName).getValue();
compareResult = integer1.compareTo(integer2);
}else{
String propertyValue1 = (String) entity1.getProperty(sortPropertyName).getValue();
String propertyValue2 = (String) entity2.getProperty(sortPropertyName).getValue();
compareResult = propertyValue1.compareTo(propertyValue2);
}
// if 'desc' is specified in the URI, change the order of the list
if(orderByItem.isDescending()){
return - compareResult; // just convert the result to negative value to change the order
}
return compareResult;
}
});
}
}
}
// 4th: create a serializer based on the requested format (json)
ODataSerializer serializer = odata.createSerializer(responseFormat);
// and serialize the content: transform from the EntitySet object to InputStream
EdmEntityType edmEntityType = edmEntitySet.getEntityType();
ContextURL contextUrl = ContextURL.with().entitySet(edmEntitySet).build();
final String id = request.getRawBaseUri() + "/" + edmEntitySet.getName();
EntityCollectionSerializerOptions opts =
EntityCollectionSerializerOptions.with().id(id).contextURL(contextUrl).build();
SerializerResult serializerResult = serializer.entityCollection(serviceMetadata, edmEntityType,
entityCollection, opts);
InputStream serializedContent = serializerResult.getContent();
// 5th: configure the response object: set the body, headers and status code
response.setContent(serializedContent);
response.setStatusCode(HttpStatusCode.OK.getStatusCode());
response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:78,代码来源:DemoEntityCollectionProcessor.java
示例20: applyOrderQueryOption
import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty; //导入依赖的package包/类
private List<Entity> applyOrderQueryOption(List<Entity> entityList, OrderByOption orderByOption) {
if (orderByOption != null) {
List<OrderByItem> orderItemList = orderByOption.getOrders();
final OrderByItem orderByItem = orderItemList.get(0); // in our example we support only one
Expression expression = orderByItem.getExpression();
if (expression instanceof Member) {
UriInfoResource resourcePath = ((Member) expression).getResourcePath();
UriResource uriResource = resourcePath.getUriResourceParts().get(0);
if (uriResource instanceof UriResourcePrimitiveProperty) {
EdmProperty edmProperty = ((UriResourcePrimitiveProperty) uriResource).getProperty();
final String sortPropertyName = edmProperty.getName();
// do the sorting for the list of entities
Collections.sort(entityList, new Comparator<Entity>() {
// we delegate the sorting to the native sorter of Integer and String
public int compare(Entity entity1, Entity entity2) {
int compareResult = 0;
if (sortPropertyName.equals("ID")) {
Integer integer1 = (Integer) entity1.getProperty(sortPropertyName).getValue();
Integer integer2 = (Integer) entity2.getProperty(sortPropertyName).getValue();
compareResult = integer1.compareTo(integer2);
} else {
String propertyValue1 = (String) entity1.getProperty(sortPropertyName).getValue();
String propertyValue2 = (String) entity2.getProperty(sortPropertyName).getValue();
compareResult = propertyValue1.compareTo(propertyValue2);
}
// if 'desc' is specified in the URI, change the order of the list
if (orderByItem.isDescending()) {
return -compareResult; // just convert the result to negative value to change the order
}
return compareResult;
}
});
}
}
}
return entityList;
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:47,代码来源:DemoEntityCollectionProcessor.java
注:本文中的org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论