本文整理汇总了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);
}
示例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();
}
示例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();
}
示例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;
}
示例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);
}
示例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());
}
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例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();
}
示例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;
示例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;