当前位置: 首页>>代码示例>>Java>>正文


Java GetSimplePropertyUriInfo类代码示例

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


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

示例1: readPropertyValue

import org.apache.olingo.odata2.api.uri.info.GetSimplePropertyUriInfo; //导入依赖的package包/类
/**
 * Does the navigation and calls {@link AbstractEntity#getProperty(String)}.
 * @param uri_info contains the navigation segments and the name of the property to get.
 * @return the value of requested property (may be null).
 * @throws ODataException
 */
public Object readPropertyValue(GetSimplePropertyUriInfo uri_info)
      throws ODataException
{
   KeyPredicate startKP = uri_info.getKeyPredicates().get(0);
   EdmProperty target
         = uri_info.getPropertyPath()
         .get(uri_info.getPropertyPath().size() - 1);

   T t = Navigator.<T>navigate(uri_info.getStartEntitySet(), startKP,
         uri_info.getNavigationSegments(), null);

   // Case of complex property
   String propName = target.getName();
   if (uri_info.getPropertyPath().size() > 1)
   {
      return t.getComplexProperty(
            uri_info.getPropertyPath().get(0).getName()).get(propName);
   }
   return t.getProperty(propName);
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:27,代码来源:AbstractEntitySet.java

示例2: readEntitySimplePropertyValue

import org.apache.olingo.odata2.api.uri.info.GetSimplePropertyUriInfo; //导入依赖的package包/类
@Override
public ODataResponse readEntitySimplePropertyValue(final GetSimplePropertyUriInfo uriInfo, final String contentType)
    throws ODataException {
  Object data = retrieveData(
      uriInfo.getStartEntitySet(),
      uriInfo.getKeyPredicates(),
      uriInfo.getFunctionImport(),
      mapFunctionParameters(uriInfo.getFunctionImportParameters()),
      uriInfo.getNavigationSegments());

  if (data == null) {
    throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
  }

  final List<EdmProperty> propertyPath = uriInfo.getPropertyPath();
  final EdmProperty property = propertyPath.get(propertyPath.size() - 1);
  final Object value = property.getMapping() == null || property.getMapping().getMediaResourceMimeTypeKey() == null ?
      getPropertyValue(data, propertyPath) : getSimpleTypeValueMap(data, propertyPath);

  return ODataResponse.fromResponse(EntityProvider.writePropertyValue(property, value)).eTag(
      constructETag(uriInfo.getTargetEntitySet(), data)).build();
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:23,代码来源:ListsProcessor.java

示例3: readEntitySimplePropertyValue

import org.apache.olingo.odata2.api.uri.info.GetSimplePropertyUriInfo; //导入依赖的package包/类
@Override
public ODataResponse readEntitySimplePropertyValue(final GetSimplePropertyUriInfo uriInfo, final String contentType)
    throws ODataException {
  Object data = retrieveData(
      uriInfo.getStartEntitySet(),
      uriInfo.getKeyPredicates(),
      uriInfo.getFunctionImport(),
      mapFunctionParameters(uriInfo.getFunctionImportParameters()),
      uriInfo.getNavigationSegments());

  // if (!appliesFilter(data, uriInfo.getFilter()))
  if (data == null) {
    throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
  }

  final List<EdmProperty> propertyPath = uriInfo.getPropertyPath();
  final EdmProperty property = propertyPath.get(propertyPath.size() - 1);
  final Object value = property.getMapping() == null || property.getMapping().getMediaResourceMimeTypeKey() == null ?
      getPropertyValue(data, propertyPath) : getSimpleTypeValueMap(data, propertyPath);

  return ODataResponse.fromResponse(EntityProvider.writePropertyValue(property, value)).eTag(
      constructETag(uriInfo.getTargetEntitySet(), data)).build();
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:24,代码来源:ListsProcessor.java

示例4: readEntitySimplePropertyValue

import org.apache.olingo.odata2.api.uri.info.GetSimplePropertyUriInfo; //导入依赖的package包/类
@Override
public ODataResponse readEntitySimplePropertyValue(final GetSimplePropertyUriInfo uriInfo, final String contentType)
    throws ODataException {
  final List<EdmProperty> propertyPath = uriInfo.getPropertyPath();
  final EdmProperty property = propertyPath.get(propertyPath.size() - 1);

  final String mappedKeyName =
      (String) uriInfo.getTargetEntitySet().getEntityType().getKeyProperties().get(0).getMapping().getObject();
  final String keyValue = uriInfo.getKeyPredicates().get(0).getLiteral();

  final int index = indexOf(mappedKeyName, keyValue);
  if ((index < 0) || (index > records.size())) {
    throw new ODataNotFoundException(ODataNotFoundException.ENTITY.addContent(keyValue));
  }
  final HashMap<String, String> record = records.get(index);

  final String mappedPropertyName = (String) property.getMapping().getObject();
  final Object value = record.get(mappedPropertyName);

  final ODataResponse response = EntityProvider.writePropertyValue(property, value);
  return response;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:23,代码来源:MapProcessor.java

示例5: readEntitySimpleProperty

import org.apache.olingo.odata2.api.uri.info.GetSimplePropertyUriInfo; //导入依赖的package包/类
@Override
public ODataResponse readEntitySimpleProperty(GetSimplePropertyUriInfo uri_info, String content_type)
      throws ODataException
{
   Object value = readPropertyValue(uri_info);
   EdmProperty target = uri_info.getPropertyPath().get(uri_info.getPropertyPath().size() - 1);
   return EntityProvider.writeProperty(content_type, target, value);
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:9,代码来源:Processor.java

示例6: readEntitySimplePropertyValue

import org.apache.olingo.odata2.api.uri.info.GetSimplePropertyUriInfo; //导入依赖的package包/类
@Override
public ODataResponse readEntitySimplePropertyValue(GetSimplePropertyUriInfo uri_info, String content_type)
      throws ODataException
{
   try
   {
      Object value = readPropertyValue(uri_info);
      EdmProperty target = uri_info.getPropertyPath().get(uri_info.getPropertyPath().size() - 1);

      if (target.getName().equals("Metalink")) // Metalink/$value
      {
         return ODataResponse
               .fromResponse(
                     EntityProvider.writeBinary(MetalinkBuilder.CONTENT_TYPE,
                     value.toString().getBytes("UTF-8")))
               .header("Content-Disposition",
                     "inline; filename=product" + MetalinkBuilder.FILE_EXTENSION)
               .build();
      }
      else
      {
         return EntityProvider.writePropertyValue(target, value);
      }
   }
   catch (UnsupportedEncodingException e)
   {
      throw new ExpectedException(e.getMessage());
   }
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:30,代码来源:Processor.java

示例7: readEntitySimpleProperty

import org.apache.olingo.odata2.api.uri.info.GetSimplePropertyUriInfo; //导入依赖的package包/类
@Override
public ODataResponse readEntitySimpleProperty(GetSimplePropertyUriInfo uriInfo, String contentType)
    throws ODataException {
  EdmProperty edmProperty = uriInfo.getPropertyPath().get(0);
  Object value = null;
  if ("EmployeeId".equals(edmProperty.getName())) {
    // must be null for a specific test
    value = null;
  } else if ("TeamId".equals(edmProperty.getName())) {
    value = new Integer(520);
  }

  return EntityProvider.writeProperty(contentType, edmProperty, value);
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:15,代码来源:InvalidDataInScenarioTest.java

示例8: readEntitySimpleProperty

import org.apache.olingo.odata2.api.uri.info.GetSimplePropertyUriInfo; //导入依赖的package包/类
@Override
public ODataResponse readEntitySimpleProperty(final GetSimplePropertyUriInfo uriInfo, final String contentType)
    throws ODataException {
  assertTrue(getContext().isInBatchMode());

  CircleStreamBuffer buffer = new CircleStreamBuffer();
  BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(buffer.getOutputStream()));
  JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
  try {
    jsonStreamWriter.beginObject()
        .name(FormatJson.D)
        .beginObject()
        .namedStringValue("EmployeeName", "Walter Winter")
        .endObject()
        .endObject();
    writer.flush();
    buffer.closeWrite();
  } catch (IOException e) {
    buffer.close();
    throw new RuntimeException(e);
  }

  ODataResponse oDataResponse =
      ODataResponse.entity(buffer.getInputStream()).status(HttpStatusCodes.OK).contentHeader("application/json")
          .build();
  return oDataResponse;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:28,代码来源:BasicBatchTest.java

示例9: readPropertyValue

import org.apache.olingo.odata2.api.uri.info.GetSimplePropertyUriInfo; //导入依赖的package包/类
/** Returns the value of the given Property. */
private Object readPropertyValue(GetSimplePropertyUriInfo uri_info) throws ODataException
{
   String targetESName = uri_info.getTargetEntitySet().getName();
   return Model.getEntitySet(targetESName).readPropertyValue(uri_info);
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:7,代码来源:Processor.java

示例10: readEntitySimpleProperty

import org.apache.olingo.odata2.api.uri.info.GetSimplePropertyUriInfo; //导入依赖的package包/类
@Override
public ODataResponse readEntitySimpleProperty(final GetSimplePropertyUriInfo uriInfo, final String contentType)
    throws ODataException {
  return readEntityComplexProperty((GetComplexPropertyUriInfo) uriInfo, contentType);
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:6,代码来源:ListsProcessor.java

示例11: readEntitySimpleProperty

import org.apache.olingo.odata2.api.uri.info.GetSimplePropertyUriInfo; //导入依赖的package包/类
@Override
public ODataResponse readEntitySimpleProperty(GetSimplePropertyUriInfo uriInfo, String contentType)
    throws ODataException {
  // this method is not needed.
  return null;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:7,代码来源:BatchHandlerTest.java

示例12: readEntitySimplePropertyValue

import org.apache.olingo.odata2.api.uri.info.GetSimplePropertyUriInfo; //导入依赖的package包/类
/**
 * @see EntitySimplePropertyValueProcessor
 */
@Override
public ODataResponse readEntitySimplePropertyValue(final GetSimplePropertyUriInfo uriInfo, final String contentType)
    throws ODataException {
  throw new ODataNotImplementedException();
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:9,代码来源:ODataSingleProcessor.java

示例13: readEntitySimpleProperty

import org.apache.olingo.odata2.api.uri.info.GetSimplePropertyUriInfo; //导入依赖的package包/类
/**
 * @see EntitySimplePropertyProcessor
 */
@Override
public ODataResponse readEntitySimpleProperty(final GetSimplePropertyUriInfo uriInfo, final String contentType)
    throws ODataException {
  throw new ODataNotImplementedException();
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:9,代码来源:ODataSingleProcessor.java

示例14: readEntitySimplePropertyValue

import org.apache.olingo.odata2.api.uri.info.GetSimplePropertyUriInfo; //导入依赖的package包/类
/**
 * Reads the unformatted value of a simple property of an entity.
 * @param uriInfo information about the request URI
 * @param contentType the content type of the response
 * @return an {@link ODataResponse} object
 * @throws ODataException
 */
ODataResponse readEntitySimplePropertyValue(GetSimplePropertyUriInfo uriInfo, String contentType)
    throws ODataException;
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:10,代码来源:EntitySimplePropertyValueProcessor.java

示例15: readEntitySimpleProperty

import org.apache.olingo.odata2.api.uri.info.GetSimplePropertyUriInfo; //导入依赖的package包/类
/**
 * Reads a simple property of an entity.
 * @param contentType the content type of the response
 * @return a {@link ODataResponse} object
 * @throws ODataException
 */
ODataResponse readEntitySimpleProperty(GetSimplePropertyUriInfo uriInfo, String contentType) throws ODataException;
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:8,代码来源:EntitySimplePropertyProcessor.java


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