本文整理汇总了Java中org.apache.olingo.server.api.uri.UriResourceComplexProperty类的典型用法代码示例。如果您正苦于以下问题:Java UriResourceComplexProperty类的具体用法?Java UriResourceComplexProperty怎么用?Java UriResourceComplexProperty使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UriResourceComplexProperty类属于org.apache.olingo.server.api.uri包,在下文中一共展示了UriResourceComplexProperty类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: collectPathToMember
import org.apache.olingo.server.api.uri.UriResourceComplexProperty; //导入依赖的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;
}
示例2: getContextURL
import org.apache.olingo.server.api.uri.UriResourceComplexProperty; //导入依赖的package包/类
@Override
public ContextURL getContextURL(OData odata) throws SerializerException {
final UriHelper helper = odata.createUriHelper();
EdmProperty edmProperty = getUriResourceProperty().getProperty();
ContextURL.Builder builder =
ContextURL.with().entitySetOrSingletonOrType(getTargetEntitySet(getEntitySet(), getNavigations()));
builder.keyPath(helper.buildContextURLKeyPredicate(getUriResourceEntitySet()
.getKeyPredicates()));
String navPath = buildNavPath(helper, getEntitySet().getEntityType(), getNavigations(), true);
if (navPath != null && !navPath.isEmpty()) {
builder.navOrPropertyPath(navPath+"/"+edmProperty.getName());
} else {
builder.navOrPropertyPath(edmProperty.getName());
}
if (isPropertyComplex()) {
EdmComplexType complexType = ((UriResourceComplexProperty) uriResourceProperty).getComplexType();
String select = helper.buildContextURLSelectList(complexType, getUriInfo().getExpandOption(),
getUriInfo().getSelectOption());
builder.selectList(select);
}
return builder.build();
}
示例3: handleLambdaAny
import org.apache.olingo.server.api.uri.UriResourceComplexProperty; //导入依赖的package包/类
/**
* Analyzes uri parts and creates a member. Lambda has expression that
* should be executed to get the inner query.
*
* @return nested or child expression member
*/
private ExpressionMember handleLambdaAny()
throws ODataApplicationException, ExpressionVisitException {
UriResourceLambdaAny lambda = (UriResourceLambdaAny) lastPart;
Expression expression = lambda.getExpression();
boolean isNavigationLambdaVar = firstPart instanceof UriResourcePartTyped
&& ((UriResourcePartTyped) firstPart).getType() instanceof EdmEntityType;
if (firstPart instanceof UriResourceNavigation || isNavigationLambdaVar) {
boolean isParentNestedLambdaVar = resourceParts.stream()
.anyMatch(part -> part instanceof UriResourceComplexProperty);
List<String> navigationTypes = collectNavigationTypes();
if (isParentNestedLambdaVar) {
// navigation parent nested collection
// book?$filter=author/_dimension/any(d:d/name eq 'Validity')
ExpressionResult lambdaResult = handleLambdaAny(expression);
return new ParentWrapperMember(navigationTypes, lambdaResult.getQueryBuilder())
.any();
} else {
if (resourceParts.size() > 2) {
// navigation parent to another child
// book?$filter=author/address/any(a:a/city eq 'New York'))
List<String> parentTypes = navigationTypes.subList(0,
navigationTypes.size() - 1);
return new ParentWrapperMember(parentTypes,
handleChildLambda(lambda).getQueryBuilder()).any();
} else {
// navigation child property collection
// author?$filter=book/any(b:b/character/any(c:c/name eq
// 'Oliver'))
return handleChildLambda(lambda);
}
}
} else {
// complex or primitive type collection
return handleLambdaAny(expression);
}
}
示例4: appendURIResourceParts
import org.apache.olingo.server.api.uri.UriResourceComplexProperty; //导入依赖的package包/类
private void appendURIResourceParts(final JsonGenerator gen, final List<UriResource> uriResourceParts)
throws IOException {
gen.writeStartArray();
for (UriResource resource : uriResourceParts) {
gen.writeStartObject();
gen.writeStringField("uriResourceKind", resource.getKind().toString());
gen.writeStringField("segment", resource.toString());
if (resource instanceof UriResourcePartTyped) {
appendType(gen, "type", ((UriResourcePartTyped) resource).getType());
gen.writeBooleanField("isCollection", ((UriResourcePartTyped) resource).isCollection());
}
if (resource instanceof UriResourceEntitySet) {
appendParameters(gen, "keys", ((UriResourceEntitySet) resource).getKeyPredicates());
appendType(gen, "typeFilterOnCollection", ((UriResourceEntitySet) resource).getTypeFilterOnCollection());
appendType(gen, "typeFilterOnEntry", ((UriResourceEntitySet) resource).getTypeFilterOnEntry());
} else if (resource instanceof UriResourceNavigation) {
appendParameters(gen, "keys", ((UriResourceNavigation) resource).getKeyPredicates());
appendType(gen, "typeFilterOnCollection", ((UriResourceNavigation) resource).getTypeFilterOnCollection());
appendType(gen, "typeFilterOnEntry", ((UriResourceNavigation) resource).getTypeFilterOnEntry());
} else if (resource instanceof UriResourceFunction) {
appendParameters(gen, "parameters", ((UriResourceFunction) resource).getParameters());
appendParameters(gen, "keys", ((UriResourceFunction) resource).getKeyPredicates());
appendType(gen, "typeFilterOnCollection", ((UriResourceFunction) resource).getTypeFilterOnCollection());
appendType(gen, "typeFilterOnEntry", ((UriResourceFunction) resource).getTypeFilterOnEntry());
} else if (resource instanceof UriResourceSingleton) {
appendType(gen, "typeFilter", ((UriResourceSingleton) resource).getEntityTypeFilter());
} else if (resource instanceof UriResourceComplexProperty) {
appendType(gen, "typeFilter", ((UriResourceComplexProperty) resource).getComplexTypeFilter());
}
gen.writeEndObject();
}
gen.writeEndArray();
}
示例5: visit
import org.apache.olingo.server.api.uri.UriResourceComplexProperty; //导入依赖的package包/类
@Override
public void visit(UriResourceComplexProperty info) {
}
示例6: visit
import org.apache.olingo.server.api.uri.UriResourceComplexProperty; //导入依赖的package包/类
@Override
public void visit(UriResourceComplexProperty info) {
this.resource = info;
}
示例7: visitMember
import org.apache.olingo.server.api.uri.UriResourceComplexProperty; //导入依赖的package包/类
@Override
public JsonNode visitMember(final Member member)
throws ExpressionVisitException, ODataApplicationException {
final List<UriResource> uriResourceParts = member.getResourcePath().getUriResourceParts();
final UriResource lastSegment = uriResourceParts.get(uriResourceParts.size() - 1);
ObjectNode result = nodeFactory.objectNode()
.put(NODE_TYPE_NAME, MEMBER_NAME)
.put(TYPE_NAME, getType(lastSegment));
putType(result, TYPE_FILTER_NAME, member.getStartTypeFilter());
ArrayNode segments = result.putArray(RESOURCE_SEGMENTS_NAME);
for (final UriResource segment : uriResourceParts) {
if (segment instanceof UriResourceLambdaAll) {
final UriResourceLambdaAll all = (UriResourceLambdaAll) segment;
segments.add(visitLambdaExpression(ALL_NAME, all.getLambdaVariable(), all.getExpression()));
} else if (segment instanceof UriResourceLambdaAny) {
final UriResourceLambdaAny any = (UriResourceLambdaAny) segment;
segments.add(visitLambdaExpression(ANY_NAME, any.getLambdaVariable(), any.getExpression()));
} else if (segment instanceof UriResourcePartTyped) {
ObjectNode node = nodeFactory.objectNode()
.put(NODE_TYPE_NAME, segment.getKind().toString())
.put(NAME_NAME, segment.toString())
.put(TYPE_NAME, getType(segment));
if (segment instanceof UriResourceEntitySet) {
putParameters(node, KEYS_NAME, ((UriResourceEntitySet) segment).getKeyPredicates());
putType(node, TYPE_FILTER_ON_COLLECTION_NAME, ((UriResourceEntitySet) segment).getTypeFilterOnCollection());
putType(node, TYPE_FILTER_ON_ENTRY_NAME, ((UriResourceEntitySet) segment).getTypeFilterOnEntry());
} else if (segment instanceof UriResourceNavigation) {
putParameters(node, KEYS_NAME, ((UriResourceNavigation) segment).getKeyPredicates());
putType(node, TYPE_FILTER_ON_COLLECTION_NAME, ((UriResourceNavigation) segment).getTypeFilterOnCollection());
putType(node, TYPE_FILTER_ON_ENTRY_NAME, ((UriResourceNavigation) segment).getTypeFilterOnEntry());
} else if (segment instanceof UriResourceFunction) {
putParameters(node, PARAMETERS_NAME, ((UriResourceFunction) segment).getParameters());
putParameters(node, KEYS_NAME, ((UriResourceFunction) segment).getKeyPredicates());
putType(node, TYPE_FILTER_ON_COLLECTION_NAME, ((UriResourceFunction) segment).getTypeFilterOnCollection());
putType(node, TYPE_FILTER_ON_ENTRY_NAME, ((UriResourceFunction) segment).getTypeFilterOnEntry());
} else if (segment instanceof UriResourceIt) {
putType(node, TYPE_FILTER_ON_COLLECTION_NAME, ((UriResourceIt) segment).getTypeFilterOnCollection());
putType(node, TYPE_FILTER_ON_ENTRY_NAME, ((UriResourceIt) segment).getTypeFilterOnEntry());
} else if (segment instanceof UriResourceSingleton) {
putType(node, TYPE_FILTER_NAME, ((UriResourceSingleton) segment).getEntityTypeFilter());
} else if (segment instanceof UriResourceComplexProperty) {
putType(node, TYPE_FILTER_NAME, ((UriResourceComplexProperty) segment).getComplexTypeFilter());
}
segments.add(node);
} else {
segments.add(nodeFactory.objectNode()
.put(NODE_TYPE_NAME, segment.getKind().toString())
.put(NAME_NAME, segment.toString())
.putNull(TYPE_NAME));
}
}
return result;
}
示例8: visit
import org.apache.olingo.server.api.uri.UriResourceComplexProperty; //导入依赖的package包/类
@Override
public void visit(UriResourceComplexProperty info) {
DataRequest dataRequest = (DataRequest) this.request;
dataRequest.setUriResourceProperty(info);
}
示例9: isPropertyComplex
import org.apache.olingo.server.api.uri.UriResourceComplexProperty; //导入依赖的package包/类
public boolean isPropertyComplex() {
return (this.uriResourceProperty instanceof UriResourceComplexProperty);
}
示例10: visit
import org.apache.olingo.server.api.uri.UriResourceComplexProperty; //导入依赖的package包/类
void visit(UriResourceComplexProperty info);