本文整理汇总了Java中org.apache.olingo.odata2.api.uri.UriInfo类的典型用法代码示例。如果您正苦于以下问题:Java UriInfo类的具体用法?Java UriInfo怎么用?Java UriInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UriInfo类属于org.apache.olingo.odata2.api.uri包,在下文中一共展示了UriInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createLink
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
@Override
public void createLink(UriInfo link) throws ODataException
{
EdmEntitySet target_es = link.getTargetEntitySet();
if (!target_es.getName().equals(Model.PRODUCT.getName()))
{
throw new ODataException("Cannot create link from Users to " + target_es.getName());
}
String pdt_uuid_s = link.getTargetKeyPredicates().get(0).getLiteral();
fr.gael.dhus.database.object.Product pta = PRODUCT_SERVICE.getProduct(pdt_uuid_s);
if (pta == null)
{
throw new InvalidKeyException(pdt_uuid_s, this.getClass().getSimpleName());
}
PRODUCTCART_SERVICE.addProductToCart(this.user.getUUID(), pta.getId());
}
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:19,代码来源:User.java
示例2: getLinkFromES
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
/**
* Extract the 'From' ES of an EntityLink.
* @param uri_info path to resource, eg: /Collections(10)/$links/Products
* @returns the EntitySet of the nav segment before the "$link" segment.
*/
private EdmEntitySet getLinkFromES(UriInfo uri_info)
{
EdmEntitySet res;
/* `uri_info`:
* StartEntitySet/Foo/bar/baz/$links/TargetEntitySet
* \__________/ \______________/
* Navigation Segments */
List<NavigationSegment> navsegs = uri_info.getNavigationSegments();
if (navsegs.size() >= 2) // `navsegs` contains at least the target segment
{
res = navsegs.get(navsegs.size()-1).getEntitySet();
}
else
{
res = uri_info.getStartEntitySet();
}
return res;
}
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:26,代码来源:Processor.java
示例3: parseRequest
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
/**
* Creates a UriInfo from a resource path and query parameters.
* The returned object may be one of UriInfo subclasses.
*
* @param resource_path path to a resource on the OData service.
* @param query_parameters OData query parameters, can be {@code null}
*
* @return an UriInfo instance exposing informations about each segment of
* the resource path and the query parameters.
*
* @throws UriSyntaxException violation of the OData URI construction rules.
* @throws UriNotMatchingException URI parsing exception.
* @throws EdmException if a problem occurs while reading the EDM.
* @throws ODataException encapsulate the OData exceptions described above.
*/
public UriInfo parseRequest (String resource_path,
Map<String, String> query_parameters) throws ODataException
{
List<PathSegment> path_segments;
if (resource_path != null && !resource_path.isEmpty ())
{
path_segments = new ArrayList<> ();
StringTokenizer st = new StringTokenizer (resource_path, "/");
while (st.hasMoreTokens ())
{
path_segments.add(UriParser.createPathSegment(st.nextToken(), null));
}
}
else path_segments = Collections.emptyList ();
if (query_parameters == null) query_parameters = Collections.emptyMap ();
return this.uriParser.parse (path_segments, query_parameters);
}
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:38,代码来源:ODataClient.java
示例4: determineJPQLContextType
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
private JPQLContextType determineJPQLContextType(UriInfo uriParserResultView, UriInfoType type) {
JPQLContextType contextType = null;
if (uriParserResultView.getNavigationSegments().size() > 0) {
if (type == UriInfoType.GetEntitySet) {
contextType = JPQLContextType.JOIN;
} else if (type == UriInfoType.Delete || type == UriInfoType.Delete || type == UriInfoType.GetEntity
|| type == UriInfoType.PutMergePatch) {
contextType = JPQLContextType.JOIN_SINGLE;
} else if (type == UriInfoType.GetEntitySetCount || type == UriInfoType.GetEntityCount) {
contextType = JPQLContextType.JOIN_COUNT;
}
} else {
if (type == UriInfoType.GetEntitySet) {
contextType = JPQLContextType.SELECT;
} else if (type == UriInfoType.Delete || type == UriInfoType.GetEntity
|| type == UriInfoType.PutMergePatch) {
contextType = JPQLContextType.SELECT_SINGLE;
} else if (type == UriInfoType.GetEntitySetCount || type == UriInfoType.GetEntityCount) {
contextType = JPQLContextType.SELECT_COUNT;
}
}
return contextType;
}
开发者ID:SAP,项目名称:cloud-olingo-identity-ochat,代码行数:25,代码来源:ConversationQueryListener.java
示例5: logReadAccess
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
@Extension(entitySetNames="Employees", methods={Method.GET})
public Object logReadAccess(ExtensionContext context) throws Exception {
UriInfo uriInfo = context.getUriInfo();
ODataResponse res;
if(uriInfo.getKeyPredicates().isEmpty()) {
LOG.info("Start READ access for Employees.");
res = context.proceed();
res = ODataResponse.fromResponse(res).header(EXTENSION_TEST, "READ EMPLOYEES SET").build();
LOG.info("Finished READ access for Employees.");
} else {
LOG.info("Start READ access for Employee.");
res = context.proceed();
res = ODataResponse.fromResponse(res).header(EXTENSION_TEST, "READ EMPLOYEE").build();
LOG.info("Finished READ access for Employee.");
}
return res;
}
开发者ID:mibo,项目名称:janos,代码行数:18,代码来源:RefExtensions.java
示例6: parseURISegmentWithCustomOptions
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
public final UriInfo parseURISegmentWithCustomOptions(final int segmentFromIndex, final int segmentToIndex,
final Map<String, String> options) throws ODataJPARuntimeException {
UriInfo uriInfo = null;
if (segmentFromIndex == segmentToIndex || segmentFromIndex > segmentToIndex || segmentFromIndex < 0) {
return uriInfo;
}
try {
edm = getEdm();
List<PathSegment> pathSegments = context.getODataContext().getPathInfo().getODataSegments();
List<PathSegment> subPathSegments = pathSegments.subList(segmentFromIndex, segmentToIndex);
uriInfo = UriParser.parse(edm, subPathSegments, options);
} catch (ODataException e) {
throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
return uriInfo;
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:ODataEntityParser.java
示例7: parseURISegment
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
public final UriInfo parseURISegment(final int segmentFromIndex, final int segmentToIndex)
throws ODataJPARuntimeException {
UriInfo uriInfo = null;
if (segmentFromIndex == segmentToIndex || segmentFromIndex > segmentToIndex || segmentFromIndex < 0) {
return uriInfo;
}
try {
edm = getEdm();
List<PathSegment> pathSegments = context.getODataContext().getPathInfo().getODataSegments();
List<PathSegment> subPathSegments = pathSegments.subList(segmentFromIndex, segmentToIndex);
uriInfo = UriParser.parse(edm, subPathSegments, Collections.<String, String> emptyMap());
} catch (ODataException e) {
throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
return uriInfo;
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:ODataEntityParser.java
示例8: parseLink
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
public final UriInfo parseLink(final EdmEntitySet entitySet, final InputStream content, final String contentType)
throws ODataJPARuntimeException {
String uriString = null;
UriInfo uri = null;
try {
uriString = EntityProvider.readLink(contentType, entitySet, content);
ODataContext odataContext = context.getODataContext();
final String svcRoot = odataContext.getPathInfo().getServiceRoot().toString();
final String path =
uriString.startsWith(svcRoot.toString()) ? uriString.substring(svcRoot.length()) : uriString;
final List<PathSegment> pathSegment = getPathSegment(path);
edm = getEdm();
uri = UriParser.parse(edm, pathSegment, Collections.<String, String> emptyMap());
} catch (ODataException e) {
throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
return uri;
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:20,代码来源:ODataEntityParser.java
示例9: parseLinkSegments
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
public UriInfo parseLinkSegments(final List<String> linkSegments, final Map<String, String> options)
throws ODataJPARuntimeException {
List<PathSegment> pathSegments = new ArrayList<PathSegment>();
for (String link : linkSegments) {
List<PathSegment> pathSegment = getPathSegment(link);
pathSegments.addAll(pathSegment);
}
UriInfo uriInfo = null;
try {
edm = getEdm();
uriInfo = UriParser.parse(edm, pathSegments, options);
} catch (ODataException e) {
throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
}
return uriInfo;
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:ODataEntityParser.java
示例10: process
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
@Override
public Object process(DeleteUriInfo uriParserResultView, final String contentType)
throws ODataJPAModelException, ODataJPARuntimeException {
if (uriParserResultView instanceof DeleteUriInfo) {
if (((UriInfo) uriParserResultView).isLinks()) {
return deleteLink(uriParserResultView);
}
}
Object selectedObject = readEntity(new JPAQueryBuilder(oDataJPAContext).build(uriParserResultView));
if (selectedObject != null) {
try{
boolean isLocalTransaction = setTransaction();
em.remove(selectedObject);
em.flush();
if (isLocalTransaction) {
oDataJPAContext.getODataJPATransaction().commit();
}
} catch(PersistenceException e){
em.getTransaction().rollback();
throw ODataJPARuntimeException.throwException(
ODataJPARuntimeException.ERROR_JPQL_DELETE_REQUEST, e);
}
}
return selectedObject;
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:26,代码来源:JPAProcessorImpl.java
示例11: build
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
public JPAQueryInfo build(GetEntitySetUriInfo uriInfo) throws ODataJPARuntimeException {
JPAQueryInfo queryInfo = new JPAQueryInfo();
Query query = null;
try {
ODataJPATombstoneEntityListener listener = getODataJPATombstoneEntityListener((UriInfo) uriInfo);
if (listener != null) {
query = listener.getQuery(uriInfo, em);
}
if (query == null) {
query = buildQuery((UriInfo) uriInfo, UriInfoType.GetEntitySet);
} else {
queryInfo.setTombstoneQuery(true);
}
} catch (Exception e) {
throw ODataJPARuntimeException.throwException(
ODataJPARuntimeException.ERROR_JPQL_QUERY_CREATE, e);
}
queryInfo.setQuery(query);
return queryInfo;
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:21,代码来源:JPAQueryBuilder.java
示例12: determineJPQLContextType
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
public JPQLContextType determineJPQLContextType(UriInfo uriParserResultView, UriInfoType type) {
JPQLContextType contextType = null;
if (!uriParserResultView.getNavigationSegments().isEmpty()) {
if (type == UriInfoType.GetEntitySet) {
contextType = JPQLContextType.JOIN;
} else if (type == UriInfoType.Delete || type == UriInfoType.GetEntity
|| type == UriInfoType.PutMergePatch) {
contextType = JPQLContextType.JOIN_SINGLE;
} else if (type == UriInfoType.GetEntitySetCount || type == UriInfoType.GetEntityCount) {
contextType = JPQLContextType.JOIN_COUNT;
}
} else {
if (type == UriInfoType.GetEntitySet) {
contextType = JPQLContextType.SELECT;
} else if (type == UriInfoType.Delete || type == UriInfoType.GetEntity
|| type == UriInfoType.PutMergePatch) {
contextType = JPQLContextType.SELECT_SINGLE;
} else if (type == UriInfoType.GetEntitySetCount || type == UriInfoType.GetEntityCount) {
contextType = JPQLContextType.SELECT_COUNT;
}
}
return contextType;
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:25,代码来源:JPAQueryBuilder.java
示例13: getDeletetUriInfo
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
private DeleteUriInfo getDeletetUriInfo() {
UriInfo objUriInfo = EasyMock.createMock(UriInfo.class);
EasyMock.expect(objUriInfo.getStartEntitySet()).andStubReturn(getLocalEdmEntitySet());
List<NavigationSegment> navSegments = new ArrayList<NavigationSegment>();
EasyMock.expect(objUriInfo.getNavigationSegments()).andReturn(navSegments).anyTimes();
EasyMock.expect(objUriInfo.getTargetEntitySet()).andStubReturn(getLocalEdmEntitySet());
EasyMock.expect(objUriInfo.getSelect()).andStubReturn(null);
EasyMock.expect(objUriInfo.getOrderBy()).andStubReturn(getOrderByExpression());
EasyMock.expect(objUriInfo.getTop()).andStubReturn(getTop());
EasyMock.expect(objUriInfo.getSkip()).andStubReturn(getSkip());
EasyMock.expect(objUriInfo.getInlineCount()).andStubReturn(getInlineCount());
EasyMock.expect(objUriInfo.getFilter()).andStubReturn(getFilter());
EasyMock.expect(objUriInfo.getKeyPredicates()).andStubReturn(getKeyPredicates());
EasyMock.expect(objUriInfo.isLinks()).andStubReturn(false);
EasyMock.replay(objUriInfo);
return objUriInfo;
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:18,代码来源:ODataJPADefaultProcessorTest.java
示例14: getLocalUriInfo
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
/**
* @return
*/
private UriInfo getLocalUriInfo() {
UriInfo objUriInfo = EasyMock.createMock(UriInfo.class);
EasyMock.expect(objUriInfo.getStartEntitySet()).andStubReturn(getLocalEdmEntitySet());
List<NavigationSegment> navSegments = new ArrayList<NavigationSegment>();
EasyMock.expect(objUriInfo.getNavigationSegments()).andReturn(navSegments).anyTimes();
EasyMock.expect(objUriInfo.getTargetEntitySet()).andStubReturn(getLocalEdmEntitySet());
EasyMock.expect(objUriInfo.getSelect()).andStubReturn(null);
EasyMock.expect(objUriInfo.getOrderBy()).andStubReturn(getOrderByExpression());
EasyMock.expect(objUriInfo.getTop()).andStubReturn(getTop());
EasyMock.expect(objUriInfo.getSkip()).andStubReturn(getSkip());
EasyMock.expect(objUriInfo.getInlineCount()).andStubReturn(getInlineCount());
EasyMock.expect(objUriInfo.getFilter()).andStubReturn(getFilter());
EasyMock.expect(objUriInfo.getFunctionImport()).andStubReturn(null);
EasyMock.replay(objUriInfo);
return objUriInfo;
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:20,代码来源:ODataJPADefaultProcessorTest.java
示例15: mockPostURIInfo
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
private PostUriInfo mockPostURIInfo(boolean isReverse) throws ODataException, NoSuchMethodException,
SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
PostUriInfo uriInfo = EasyMock.createMock(UriInfo.class);
for (EdmEntitySet edmEntitySet : edm.getEntitySets()) {
if (edmEntitySet.getName().equals("Notes")) {
EasyMock.expect(uriInfo.getTargetEntitySet()).andReturn(edmEntitySet).anyTimes();
break;
}
}
EasyMock.expect(((UriInfo) uriInfo).isLinks()).andReturn(true);
EasyMock.expect(uriInfo.getNavigationSegments()).andReturn(mockNavigationSegments(isReverse)).anyTimes();
EasyMock.replay(uriInfo);
return uriInfo;
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:JPALinkTest.java
示例16: getDeletetUriInfo
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
private DeleteUriInfo getDeletetUriInfo() {
UriInfo objUriInfo = EasyMock.createMock(UriInfo.class);
EasyMock.expect(objUriInfo.getStartEntitySet()).andStubReturn(getLocalEdmEntitySet());
EasyMock.expect(objUriInfo.getTargetEntitySet()).andStubReturn(getLocalEdmEntitySet());
EasyMock.expect(objUriInfo.getSelect()).andStubReturn(null);
EasyMock.expect(objUriInfo.getOrderBy()).andStubReturn(getOrderByExpression());
EasyMock.expect(objUriInfo.getTop()).andStubReturn(getTop());
EasyMock.expect(objUriInfo.getSkip()).andStubReturn(getSkip());
EasyMock.expect(objUriInfo.getInlineCount()).andStubReturn(getInlineCount());
EasyMock.expect(objUriInfo.getFilter()).andStubReturn(getFilter());
EasyMock.expect(objUriInfo.getKeyPredicates()).andStubReturn(getKeyPredicates());
EasyMock.expect(objUriInfo.isLinks()).andStubReturn(false);
EasyMock.expect(objUriInfo.getNavigationSegments()).andReturn(new ArrayList<NavigationSegment>());
EasyMock.replay(objUriInfo);
return objUriInfo;
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:JPAProcessorImplTest.java
示例17: getEntitySetUriInfo
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
private GetEntitySetUriInfo getEntitySetUriInfo() {
UriInfo objUriInfo = EasyMock.createMock(UriInfo.class);
EasyMock.expect(objUriInfo.getStartEntitySet()).andStubReturn(getLocalEdmEntitySet());
EasyMock.expect(objUriInfo.getTargetEntitySet()).andStubReturn(getLocalEdmEntitySet());
EasyMock.expect(objUriInfo.getSelect()).andStubReturn(null);
EasyMock.expect(objUriInfo.getOrderBy()).andStubReturn(getOrderByExpression());
EasyMock.expect(objUriInfo.getTop()).andStubReturn(getTop());
EasyMock.expect(objUriInfo.getSkip()).andStubReturn(getSkip());
EasyMock.expect(objUriInfo.getSkipToken()).andReturn("5");
EasyMock.expect(objUriInfo.getInlineCount()).andStubReturn(getInlineCount());
EasyMock.expect(objUriInfo.getFilter()).andStubReturn(getFilter());
EasyMock.expect(objUriInfo.getFunctionImport()).andStubReturn(null);
EasyMock.expect(objUriInfo.getCustomQueryOptions()).andStubReturn(null);
EasyMock.expect(objUriInfo.getNavigationSegments()).andStubReturn(new ArrayList<NavigationSegment>());
EasyMock.replay(objUriInfo);
return objUriInfo;
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:19,代码来源:JPAProcessorImplTest.java
示例18: mockURIInfoWithListener
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
private UriInfo mockURIInfoWithListener(boolean isNavigationEnabled) throws EdmException {
UriInfo uriInfo = EasyMock.createMock(UriInfo.class);
if (isNavigationEnabled) {
List<NavigationSegment> navSegments = new ArrayList<NavigationSegment>();
navSegments.add(null);
EasyMock.expect(uriInfo.getNavigationSegments()).andReturn(navSegments);
EasyMock.replay(uriInfo);
return uriInfo;
}
EdmEntityType edmEntityType = EasyMock.createMock(EdmEntityType.class);
EasyMock.expect(edmEntityType.getMapping()).andReturn((EdmMapping) mockEdmMapping());
EdmEntitySet edmEntitySet = EasyMock.createMock(EdmEntitySet.class);
EasyMock.expect(edmEntitySet.getEntityType()).andReturn(edmEntityType);
EasyMock.expect(uriInfo.getTargetEntitySet()).andReturn(edmEntitySet);
EasyMock.replay(edmEntityType, edmEntitySet, uriInfo);
return uriInfo;
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:19,代码来源:JPAQueryBuilderTest.java
示例19: parseAll
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
@Override
public UriInfo parseAll(final List<PathSegment> pathSegments, final Map<String, List<String>> allQueryParameters)
throws UriSyntaxException, UriNotMatchingException, EdmException {
this.pathSegments = copyPathSegmentList(pathSegments);
systemQueryOptions = new HashMap<SystemQueryOption, String>();
otherQueryParameters = new HashMap<String, String>();
uriResult = new UriInfoImpl();
preparePathSegments();
handleResourcePath();
distributeQueryParameters(allQueryParameters);
checkSystemQueryOptionsCompatibility();
handleSystemQueryOptions();
handleOtherQueryParameters();
return uriResult;
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:21,代码来源:UriParserImpl.java
示例20: minimal
import org.apache.olingo.odata2.api.uri.UriInfo; //导入依赖的package包/类
@Test
public void minimal() throws Exception {
final ODataContext context = mockContext(ODataHttpMethod.PUT);
final ODataResponse wrappedResponse = mockResponse(HttpStatusCodes.NO_CONTENT, null, null);
ODataResponse response = new ODataDebugResponseWrapper(context, wrappedResponse, mock(UriInfo.class), null,
ODataDebugResponseWrapper.ODATA_DEBUG_JSON).wrapResponse();
final String actualJson = StringHelper.inputStreamToString((InputStream) response.getEntity());
assertEquals(EXPECTED.replace(ODataHttpMethod.GET.name(), ODataHttpMethod.PUT.name())
.replace(Integer.toString(HttpStatusCodes.OK.getStatusCode()),
Integer.toString(HttpStatusCodes.NO_CONTENT.getStatusCode()))
.replace(HttpStatusCodes.OK.getInfo(), HttpStatusCodes.NO_CONTENT.getInfo()),
actualJson);
response = new ODataDebugResponseWrapper(context, wrappedResponse, mock(UriInfo.class), null,
ODataDebugResponseWrapper.ODATA_DEBUG_HTML).wrapResponse();
final String html = StringHelper.inputStreamToString((InputStream) response.getEntity());
assertTrue(html.contains(HttpStatusCodes.NO_CONTENT.getInfo()));
}
开发者ID:apache,项目名称:olingo-odata2,代码行数:20,代码来源:ODataDebugResponseWrapperTest.java
注:本文中的org.apache.olingo.odata2.api.uri.UriInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论