• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java UriResource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.olingo.server.api.uri.UriResource的典型用法代码示例。如果您正苦于以下问题:Java UriResource类的具体用法?Java UriResource怎么用?Java UriResource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UriResource类属于org.apache.olingo.server.api.uri包,在下文中一共展示了UriResource类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: toSort

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的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: readReferenceCollection

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的package包/类
static public EntityCollection readReferenceCollection(RdfEdmProvider rdfEdmProvider, UriInfo uriInfo,
		UriType uriType) throws OData2SparqlException, EdmException, ODataApplicationException, ExpressionVisitException {
	List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
	RdfEntityType rdfEntityType = null;
	EdmEntitySet edmEntitySet = null;

	UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths.get(0);
	edmEntitySet = uriResourceEntitySet.getEntitySet();
	rdfEntityType = rdfEdmProvider.getRdfEntityTypefromEdmEntitySet(edmEntitySet);
	SparqlQueryBuilder sparqlBuilder = new SparqlQueryBuilder(rdfEdmProvider.getRdfModel(),
			rdfEdmProvider.getEdmMetadata(), uriInfo, uriType);

	//prepareQuery
	SparqlStatement sparqlStatement = sparqlBuilder.prepareEntityLinksSparql();
	SparqlEntityCollection rdfResults = sparqlStatement.executeConstruct(rdfEdmProvider, rdfEntityType, null, null);

	if (rdfResults == null) {
		throw new ODataApplicationException("No results", HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(),
				Locale.ENGLISH);
	} else {
		return rdfResults;
	}
}
 
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:24,代码来源:SparqlBaseCommand.java


示例3: deleteEntity

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的package包/类
public static void deleteEntity(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);
	// 2. delete the data in backend
	List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();

	SparqlCreateUpdateDeleteBuilder sparqlCreateUpdateDeleteBuilder = new SparqlCreateUpdateDeleteBuilder(
			rdfEdmProvider);
	try {
		sparqlStatement = sparqlCreateUpdateDeleteBuilder.generateDeleteEntity(entityType, keyPredicates);
	} catch (Exception e) {
		log.error(e.getMessage());
		throw new OData2SparqlException(e.getMessage());
	}
	sparqlStatement.executeDelete(rdfEdmProvider);
}
 
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:22,代码来源:SparqlBaseCommand.java


示例4: updateEntity

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的package包/类
public static void updateEntity(RdfEdmProvider rdfEdmProvider, UriInfo uriInfo, Entity requestEntity,
		HttpMethod httpMethod) 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();
	//EdmEntityType edmEntityType = edmEntitySet.getEntityType();

	RdfEntityType entityType = rdfEdmProvider.getRdfEntityTypefromEdmEntitySet(edmEntitySet);

	List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();
	// Note that this updateEntity()-method is invoked for both PUT or PATCH operations  
	SparqlCreateUpdateDeleteBuilder sparqlCreateUpdateDeleteBuilder = new SparqlCreateUpdateDeleteBuilder(
			rdfEdmProvider);
	try {
		sparqlStatement = sparqlCreateUpdateDeleteBuilder.generateUpdateEntity(entityType, keyPredicates,
				requestEntity);
	} catch (Exception e) {
		log.error(e.getMessage());
		throw new OData2SparqlException(e.getMessage());
	}
	sparqlStatement.executeDelete(rdfEdmProvider);
}
 
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:26,代码来源:SparqlBaseCommand.java


示例5: updatePrimitiveValue

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的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


示例6: deleteEntityReference

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的package包/类
public static void deleteEntityReference(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> entityKeyPredicates = uriResourceEntitySet.getKeyPredicates();
	UriResourceNavigation uriResourceNavigation = (UriResourceNavigation) resourcePaths.get(1);
	RdfAssociation navigationProperty = entityType
			.findNavigationProperty(uriResourceNavigation.getProperty().getName());
	List<UriParameter> navigationKeyPredicates = uriResourceNavigation.getKeyPredicates();
	SparqlCreateUpdateDeleteBuilder sparqlCreateUpdateDeleteBuilder = new SparqlCreateUpdateDeleteBuilder(
			rdfEdmProvider);
	try {
		sparqlStatement = sparqlCreateUpdateDeleteBuilder.generateDeleteLinkQuery( entityType, entityKeyPredicates,navigationProperty,navigationKeyPredicates);
	} catch (Exception e) {
		log.error(e.getMessage());
		throw new OData2SparqlException(e.getMessage());
	}
	sparqlStatement.executeInsert(rdfEdmProvider);
}
 
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:26,代码来源:SparqlBaseCommand.java


示例7: serialize

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的package包/类
@Override
protected SerializerResult serialize(ODataSerializer serializer,
        InstanceData<EdmPrimitiveType, Property> data, ElasticEdmEntitySet entitySet,
        UriInfo uriInfo) throws SerializerException {
    List<UriResource> resourceParts = uriInfo.getUriResourceParts();
    UriResourceProperty uriProperty = (UriResourceProperty) resourceParts
            .get(resourceParts.size() - 1);
    ElasticEdmProperty edmProperty = (ElasticEdmProperty) uriProperty.getProperty();
    String propertyName = edmProperty.getName();
    return serializer.primitive(serviceMetadata, data.getType(), data.getValue(),
            PrimitiveSerializerOptions.with()
                    .contextURL(createContextUrl(entitySet, true, null, null, propertyName))
                    .scale(edmProperty.getScale()).nullable(edmProperty.isNullable())
                    .precision(edmProperty.getPrecision()).maxLength(edmProperty.getMaxLength())
                    .unicode(edmProperty.isUnicode()).build());
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:17,代码来源:PrimitiveProcessorImpl.java


示例8: getProperties

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的package包/类
/**
 * Get's properties from {@link #groupBy} for aggregation query.
 * 
 * @param groupBy
 *            groupBy instance
 * @return list of properties
 * @throws ODataApplicationException
 *             if any error occurred
 */
private static List<String> getProperties(GroupBy groupBy) throws ODataApplicationException {
    List<String> groupByProperties = new ArrayList<>();
    for (GroupByItem item : groupBy.getGroupByItems()) {
        List<UriResource> path = item.getPath();
        if (path.size() > 1) {
            throwNotImplemented("Grouping by navigation property is not supported yet.");
        }
        UriResource resource = path.get(0);
        if (resource.getKind() == UriResourceKind.primitiveProperty) {
            groupByProperties.add(resource.getSegmentValue());
        } else {
            throwNotImplemented("Grouping by complex type is not supported yet.");
        }
    }
    return groupByProperties;
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:26,代码来源:BucketsAggregationsRequestCreator.java


示例9: getSelectList

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的package包/类
/**
 * Returns the list of fields from URL.
 * @param uriInfo uri info
 * @return fields fields from URL
 */
protected List<String> getSelectList(UriInfo uriInfo) {
    List<String> result = new ArrayList<>();
    SelectOption selectOption = uriInfo.getSelectOption();
    if (selectOption != null) {
        List<SelectItem> selectItems = selectOption.getSelectItems();
        for (SelectItem selectItem : selectItems) {
            List<UriResource> selectParts = selectItem.getResourcePath().getUriResourceParts();
            String fieldName = selectParts.get(selectParts.size() - 1).getSegmentValue();
            result.add(fieldName);
        }
    } else {
        List<UriResource> resourceParts = uriInfo.getUriResourceParts();
        if (resourceParts.size() > 1) {
            UriResource lastResource = resourceParts.get(resourceParts.size() - 1);
            if (lastResource.getKind() == UriResourceKind.primitiveProperty) {
                result.add(((UriResourceProperty) lastResource).getProperty().getName());
            }
        }
    }
    return result;
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:27,代码来源:SearchRequestCreator.java


示例10: addSegmentQuery

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的package包/类
/**
 * Method adds query depending on current and next URI resource segment.
 * 
 * @param segment
 *            current segment
 * @param nextSegment
 *            next segment
 * @return casted queryBuilder
 * @throws ODataApplicationException
 *             if any error occurred
 */
@SuppressWarnings("unchecked")
public T addSegmentQuery(UriResource segment, UriResource nextSegment)
        throws ODataApplicationException {
    ElasticEdmEntityType type = (ElasticEdmEntityType) ((UriResourcePartTyped) segment)
            .getType();
    String esType = type.getESType();
    List<String> ids = collectIds(segment);
    if (nextSegment == null) {
        addIdQuery(esType, ids);
    } else {
        if (nextSegment.getKind() == UriResourceKind.primitiveProperty) {
            addIdQuery(esType, ids);
        } else {
            if (((UriResourceNavigationPropertyImpl) nextSegment).getProperty()
                    .isCollection()) {
                addParentQuery(esType, ids);
            } else {
                addChildQuery(esType, ids);
            }
        }
    }
    return (T) this;
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:35,代码来源:ESQueryBuilder.java


示例11: getData

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的package包/类
/**
 * Helper method for providing some sample data.
 *
 * @param edmEntitySet
 *            for which the data is requested
 * @return data of requested entity set
 */
private EntitySet getData(UriInfo uriInfo) {
	List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
	UriResourceEntitySet uriResourceEntitySet = (UriResourceEntitySet) resourcePaths
			.get(0); // in our example, the first segment is the EntitySet
	EdmEntitySet edmEntitySet = uriResourceEntitySet.getEntitySet();

	EntitySet entitySet = null;

	Map<String, EntityProvider> entityProviders = ctx
			.getBeansOfType(EntityProvider.class);

	for (String entity : entityProviders.keySet()) {
		EntityProvider entityProvider = entityProviders.get(entity);
		if (entityProvider
				.getEntityType().getName()
				
				.equals(edmEntitySet.getEntityType().getName())) {
			entitySet = entityProvider.getEntitySet(uriInfo);
			break;
		}
	}
	return entitySet;
}
 
开发者ID:rohitghatol,项目名称:spring-boot-Olingo-oData,代码行数:31,代码来源:GenericEntityCollectionProcessor.java


示例12: blockTypeFilters

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的package包/类
private void blockTypeFilters(final UriResource uriResource)
        throws ODataApplicationException
{
    if (((uriResource instanceof UriResourceEntitySet)
            && (((UriResourceEntitySet) uriResource).getTypeFilterOnCollection() != null
            || ((UriResourceEntitySet) uriResource).getTypeFilterOnEntry()
            != null)) || ((uriResource instanceof UriResourceFunction)
            && (((UriResourceFunction) uriResource).getTypeFilterOnCollection() != null
            || ((UriResourceFunction) uriResource).getTypeFilterOnEntry()
            != null)) || ((uriResource instanceof UriResourceNavigation)
            && (((UriResourceNavigation) uriResource).getTypeFilterOnCollection() != null
            || ((UriResourceNavigation) uriResource).getTypeFilterOnEntry() != null)))
    {
        throw new ODataApplicationException("Type filters are not supported.",
                                            HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(),
                                            Locale.ROOT);
    }
}
 
开发者ID:RedHelixOrg,项目名称:RedHelix-1,代码行数:19,代码来源:RedHxDiscoveryProcessor.java


示例13: getEdmTypeForContNavProperty

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的package包/类
private EdmEntityType getEdmTypeForContNavProperty(UriInfo uriInfo) {
  List<UriResource> pathSegments = uriInfo.getUriResourceParts();
  EdmEntityType type = null;
  for(UriResource resource : pathSegments) {
    if (resource instanceof UriResourceNavigation) {
      UriResourceNavigation navResource = (UriResourceNavigation) resource;
      if (navResource.getProperty().containsTarget()) {
        if (navResource.getTypeFilterOnCollection() != null) {
          type = ((EdmEntityType) navResource.getTypeFilterOnCollection());
        } else if (navResource.getTypeFilterOnEntry() != null) {
          type = ((EdmEntityType) navResource.getTypeFilterOnEntry());
        } else {
          type = ((EdmEntityType) navResource.getType());
        }
      }
    }
  }
  return type;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:20,代码来源:TechnicalEntityProcessor.java


示例14: readEntity

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的package包/类
/**
 * This method is invoked when a single entity has to be read.
 * In our example, this can be either a "normal" read operation, or a navigation:
 * 
 * Example for "normal" read operation:
 * http://localhost:8080/DemoService/DemoService.svc/Products(1)
 * 
 * Example for navigation
 * http://localhost:8080/DemoService/DemoService.svc/Products(1)/Category
 */
public void readEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
    throws ODataApplicationException, SerializerException {
  
  // The sample service supports only functions imports and entity sets.
  // We do not care about bound functions and composable functions.
  
  UriResource uriResource = uriInfo.getUriResourceParts().get(0); 
  
  if(uriResource instanceof UriResourceEntitySet) {
    readEntityInternal(request, response, uriInfo, responseFormat);
  } else if(uriResource instanceof UriResourceFunction) {
    readFunctionImportInternal(request, response, uriInfo, responseFormat);
  } else {
    throw new ODataApplicationException("Only EntitySet is supported",
        HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
  }
  
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:29,代码来源:DemoEntityProcessor.java


示例15: updateEntity

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的package包/类
public void updateEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo,
                          ContentType requestFormat, ContentType responseFormat)
						throws ODataApplicationException, DeserializerException, SerializerException {
	
	// 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();
	EdmEntityType edmEntityType = edmEntitySet.getEntityType();

	// 2. update the data in backend
	// 2.1. retrieve the payload from the PUT request for the entity to be updated 
	InputStream requestInputStream = request.getBody();
	ODataDeserializer deserializer = odata.createDeserializer(requestFormat);
	DeserializerResult result = deserializer.entity(requestInputStream, edmEntityType);
	Entity requestEntity = result.getEntity();
	// 2.2 do the modification in backend
	List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();
	// Note that this updateEntity()-method is invoked for both PUT or PATCH operations
	HttpMethod httpMethod = request.getMethod();
	storage.updateEntityData(edmEntitySet, keyPredicates, requestEntity, httpMethod);
	
	//3. configure the response object
	response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:DemoEntityProcessor.java


示例16: updateEntity

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的package包/类
public void updateEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo,
    ContentType requestFormat, ContentType responseFormat)
        throws ODataApplicationException, DeserializerException, SerializerException {

  // 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();
  EdmEntityType edmEntityType = edmEntitySet.getEntityType();

  // 2. update the data in backend
  // 2.1. retrieve the payload from the PUT request for the entity to be updated
  InputStream requestInputStream = request.getBody();
  ODataDeserializer deserializer = this.odata.createDeserializer(requestFormat);
  DeserializerResult result = deserializer.entity(requestInputStream, edmEntityType);
  Entity requestEntity = result.getEntity();
  // 2.2 do the modification in backend
  List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();
  // Note that this updateEntity()-method is invoked for both PUT or PATCH operations
  HttpMethod httpMethod = request.getMethod();
  storage.updateEntityData(edmEntitySet, keyPredicates, requestEntity, httpMethod);

  // 3. configure the response object
  response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:DemoEntityProcessor.java


示例17: deleteEntity

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的package包/类
public void deleteEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo)
         throws ODataApplicationException {
	
	// 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();

	// 2. delete the data in backend
	List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();
	storage.deleteEntityData(edmEntitySet, keyPredicates);
	
	//3. configure the response object
	response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:17,代码来源:DemoEntityProcessor.java


示例18: visitMember

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的package包/类
@Override
public String visitMember(final Member member) throws ExpressionVisitException, ODataApplicationException {
  String ret = "";

  for (UriResource item : member.getResourcePath().getUriResourceParts()) {
    String tmp = "";
    if (item instanceof UriResourceLambdaAll) {
      UriResourceLambdaAll all = (UriResourceLambdaAll) item;
      tmp = visitLambdaExpression("ALL", all.getLambdaVariable(), all.getExpression());
    } else if (item instanceof UriResourceLambdaAny) {
      UriResourceLambdaAny any = (UriResourceLambdaAny) item;
      tmp = visitLambdaExpression("ANY", any.getLambdaVariable(), any.getExpression());
    } else if (item instanceof UriResourcePartTyped) {
      UriResourcePartTyped typed = (UriResourcePartTyped) item;
      tmp = typed.toString(true);
    }

    if (ret.length() > 0) {
      ret += "/";
    }
    ret += tmp;

  }
  return "<" + ret + ">";
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:26,代码来源:FilterTreeToText.java


示例19: mustValidate

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的package包/类
private boolean mustValidate(final String uri, final String entitySetName)
    throws UriParserException, UriValidationException, PreconditionException {
  final UriInfo uriInfo = new Parser(edm, odata).parseUri(uri, null, null, null);
  final List<UriResource> parts = uriInfo.getUriResourceParts();
  final boolean isMedia = parts.size() >= 2
      && parts.get(parts.size() - 1) instanceof UriResourceValue
      && parts.get(parts.size() - 2) instanceof UriResourceEntitySet;

  CustomETagSupport support = mock(CustomETagSupport.class);
  final Answer<Boolean> answer = new Answer<Boolean>() {
    public Boolean answer(final InvocationOnMock invocation) throws Throwable {
      if (entitySetName != null) {
        assertEquals(entitySetName, ((EdmBindingTarget) invocation.getArguments()[0]).getName());
      }
      return true;
    }};
  when(support.hasETag(any(EdmBindingTarget.class))).thenAnswer(answer);
  when(support.hasMediaETag(any(EdmBindingTarget.class))).thenAnswer(answer);

  return new PreconditionsValidator(uriInfo).mustValidatePreconditions(support, isMedia);
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:22,代码来源:PreconditionsValidatorTest.java


示例20: handleCountDispatching

import org.apache.olingo.server.api.uri.UriResource; //导入依赖的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



注:本文中的org.apache.olingo.server.api.uri.UriResource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InVMConnectorFactory类代码示例发布时间:2022-05-22
下一篇:
Java RegisterNodeManagerRequestProto类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap