本文整理汇总了Java中org.apache.olingo.commons.api.edm.EdmEntityType.getBaseType方法的典型用法代码示例。如果您正苦于以下问题:Java EdmEntityType.getBaseType方法的具体用法?Java EdmEntityType.getBaseType怎么用?Java EdmEntityType.getBaseType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.olingo.commons.api.edm.EdmEntityType
的用法示例。
在下文中一共展示了EdmEntityType.getBaseType方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appendKey
import org.apache.olingo.commons.api.edm.EdmEntityType; //导入方法依赖的package包/类
private void appendKey(final JsonGenerator json,
final EdmEntityType entityType) throws SerializerException, IOException {
List<EdmKeyPropertyRef> keyPropertyRefs = entityType.getKeyPropertyRefs();
if (keyPropertyRefs != null && !keyPropertyRefs.isEmpty()) {
// Resolve Base Type key as it is shown in derived type
EdmEntityType baseType = entityType.getBaseType();
if (baseType != null && baseType.getKeyPropertyRefs() != null && !(baseType.getKeyPropertyRefs().isEmpty())) {
return;
}
json.writeArrayFieldStart(KEY);
for (EdmKeyPropertyRef keyRef : keyPropertyRefs) {
if (keyRef.getAlias() != null) {
json.writeStartObject();
json.writeStringField(keyRef.getAlias(), keyRef.getName());
json.writeEndObject();
} else {
json.writeString(keyRef.getName());
}
}
json.writeEndArray();
}
}
示例2: resolveEntityType
import org.apache.olingo.commons.api.edm.EdmEntityType; //导入方法依赖的package包/类
protected EdmEntityType resolveEntityType(final ServiceMetadata metadata, final EdmEntityType baseType,
final String derivedTypeName) throws SerializerException {
if (derivedTypeName == null ||
baseType.getFullQualifiedName().getFullQualifiedNameAsString().equals(derivedTypeName)) {
return baseType;
}
EdmEntityType derivedType = metadata.getEdm().getEntityType(new FullQualifiedName(derivedTypeName));
if (derivedType == null) {
throw new SerializerException("EntityType not found",
SerializerException.MessageKeys.UNKNOWN_TYPE, derivedTypeName);
}
EdmEntityType type = derivedType.getBaseType();
while (type != null) {
if (type.getFullQualifiedName().equals(baseType.getFullQualifiedName())) {
return derivedType;
}
type = type.getBaseType();
}
throw new SerializerException("Wrong base type",
SerializerException.MessageKeys.WRONG_BASE_TYPE, derivedTypeName,
baseType.getFullQualifiedName().getFullQualifiedNameAsString());
}
示例3: resolveEntityType
import org.apache.olingo.commons.api.edm.EdmEntityType; //导入方法依赖的package包/类
protected EdmEntityType resolveEntityType(final ServiceMetadata metadata, final EdmEntityType baseType,
final String derivedTypeName) throws SerializerException {
if (derivedTypeName == null ||
baseType.getFullQualifiedName().getFullQualifiedNameAsString().equals(derivedTypeName)) {
return baseType;
}
EdmEntityType derivedType = metadata.getEdm().getEntityType(new FullQualifiedName(derivedTypeName));
if (derivedType == null) {
throw new SerializerException("EntityType not found",
SerializerException.MessageKeys.UNKNOWN_TYPE, derivedTypeName);
}
EdmEntityType type = derivedType.getBaseType();
while (type != null) {
if (type.getFullQualifiedName().getFullQualifiedNameAsString()
.equals(baseType.getFullQualifiedName().getFullQualifiedNameAsString())) {
return derivedType;
}
type = type.getBaseType();
}
throw new SerializerException("Wrong base type",
SerializerException.MessageKeys.WRONG_BASE_TYPE, derivedTypeName, baseType
.getFullQualifiedName().getFullQualifiedNameAsString());
}
示例4: appendKey
import org.apache.olingo.commons.api.edm.EdmEntityType; //导入方法依赖的package包/类
private void appendKey(final XMLStreamWriter writer, final EdmEntityType entityType) throws XMLStreamException {
List<EdmKeyPropertyRef> keyPropertyRefs = entityType.getKeyPropertyRefs();
if (keyPropertyRefs != null && !keyPropertyRefs.isEmpty()) {
// Resolve Base Type key as it is shown in derived type
EdmEntityType baseType = entityType.getBaseType();
if (baseType != null && baseType.getKeyPropertyRefs() != null && !(baseType.getKeyPropertyRefs().isEmpty())) {
return;
}
writer.writeStartElement(XML_KEY);
for (EdmKeyPropertyRef keyRef : keyPropertyRefs) {
writer.writeEmptyElement(XML_PROPERTY_REF);
writer.writeAttribute(XML_NAME, keyRef.getName());
if (keyRef.getAlias() != null) {
writer.writeAttribute(XML_ALIAS, keyRef.getAlias());
}
}
writer.writeEndElement();
}
}
示例5: validateEdmEntityTypes
import org.apache.olingo.commons.api.edm.EdmEntityType; //导入方法依赖的package包/类
/**
* This method validates Edm Entity types.
* Looks for correct namespace aliases and correct base types
*/
private void validateEdmEntityTypes() {
for (Map.Entry<FullQualifiedName, EdmEntityType> entityTypes : edmEntityTypesMap.entrySet()) {
if (entityTypes.getValue() != null && entityTypes.getKey() != null) {
EdmEntityType entityType = entityTypes.getValue();
if (entityType.getBaseType() != null) {
FullQualifiedName baseTypeFQName = entityType.getBaseType().getFullQualifiedName();
EdmEntityType baseEntityType = edmEntityTypesMap.get(baseTypeFQName);
if (baseEntityType != null && baseEntityType.getKeyPredicateNames().isEmpty()) {
throw new RuntimeException("Missing key for EntityType " + baseEntityType.getName());
}
} else if (entityType.getKeyPredicateNames().isEmpty()) {
throw new RuntimeException("Missing key for EntityType " + entityType.getName());
}
}
}
}
示例6: appendEntityTypes
import org.apache.olingo.commons.api.edm.EdmEntityType; //导入方法依赖的package包/类
private void appendEntityTypes(JsonGenerator json,
List<EdmEntityType> entityTypes) throws SerializerException, IOException {
for (EdmEntityType entityType : entityTypes) {
json.writeObjectFieldStart(entityType.getName());
json.writeStringField(KIND, Kind.EntityType.name());
if (entityType.hasStream()) {
json.writeBooleanField(HAS_STREAM, entityType.hasStream());
}
if (entityType.getBaseType() != null) {
json.writeStringField(BASE_TYPE, getAliasedFullQualifiedName(entityType.getBaseType()));
}
if (entityType.isAbstract()) {
json.writeBooleanField(ABSTRACT, entityType.isAbstract());
}
appendKey(json, entityType);
appendProperties(json, entityType);
appendNavigationProperties(json, entityType);
appendAnnotations(json, entityType, null);
json.writeEndObject();
}
}
示例7: appendEntityTypes
import org.apache.olingo.commons.api.edm.EdmEntityType; //导入方法依赖的package包/类
private void appendEntityTypes(final XMLStreamWriter writer, final List<EdmEntityType> entityTypes)
throws XMLStreamException {
for (EdmEntityType entityType : entityTypes) {
writer.writeStartElement(XML_ENTITY_TYPE);
writer.writeAttribute(XML_NAME, entityType.getName());
if (entityType.hasStream()) {
writer.writeAttribute(XML_HAS_STREAM, "" + entityType.hasStream());
}
if (entityType.getBaseType() != null) {
writer.writeAttribute(XML_BASE_TYPE, getAliasedFullQualifiedName(entityType.getBaseType(), false));
}
if (entityType.isAbstract()) {
writer.writeAttribute(ABSTRACT, TRUE);
}
appendKey(writer, entityType);
appendProperties(writer, entityType);
appendNavigationProperties(writer, entityType);
appendAnnotations(writer, entityType);
writer.writeEndElement();
}
}
示例8: justInheritedOperationsBoundTo
import org.apache.olingo.commons.api.edm.EdmEntityType; //导入方法依赖的package包/类
public List<EdmOperation> justInheritedOperationsBoundTo(final EdmEntityType entity) {
final List<EdmOperation> result = new ArrayList<EdmOperation>();
if (entity.getBaseType() != null) {
result.addAll(getFunctionsBoundTo(entity.getBaseType().getName(), false));
result.addAll(getActionsBoundTo(entity.getBaseType().getName(), false));
result.addAll(justInheritedOperationsBoundTo(entity.getBaseType()));
}
return result;
}
示例9: getEntityKeyType
import org.apache.olingo.commons.api.edm.EdmEntityType; //导入方法依赖的package包/类
public Map<String, String> getEntityKeyType(final EdmEntityType entityType) {
EdmEntityType baseType = entityType;
while (CollectionUtils.isEmpty(baseType.getKeyPredicateNames()) && baseType.getBaseType() != null) {
baseType = getEdmTypeInfo(baseType.getBaseType().getFullQualifiedName().toString()).getEntityType();
}
final Map<String, String> res = new LinkedHashMap<String, String>();
for (EdmKeyPropertyRef pref : baseType.getKeyPropertyRefs()) {
res.put(pref.getName(),
getJavaType(pref.getProperty().getType().getFullQualifiedName().toString()));
}
return res;
}
示例10: populateDescendants
import org.apache.olingo.commons.api.edm.EdmEntityType; //导入方法依赖的package包/类
private void populateDescendants(final EdmTypeInfo base, final List<String> descendants) {
for (Map.Entry<String, List<EdmEntityType>> entry : allEntityTypes.entrySet()) {
for (EdmEntityType type : entry.getValue()) {
if (type.getBaseType() != null
&& base.getFullQualifiedName().equals(type.getBaseType().getFullQualifiedName())) {
final EdmTypeInfo entityTypeInfo = getEdmTypeInfo(type.getFullQualifiedName().toString());
descendants.add(entityTypeInfo.getFullQualifiedName().toString());
populateDescendants(entityTypeInfo, descendants);
}
}
}
}
示例11: getBoundOperation
import org.apache.olingo.commons.api.edm.EdmEntityType; //导入方法依赖的package包/类
private Map.Entry<URI, EdmOperation> getBoundOperation(final Operation operation, final List<String> parameterNames) {
final ClientEntity entity = EntityInvocationHandler.class.cast(target).getEntity();
final URI entityURI = EntityInvocationHandler.class.cast(target).getEntityURI();
ClientOperation boundOp = entity.getOperation(operation.name());
if (boundOp == null) {
boundOp = entity.getOperation(new FullQualifiedName(targetFQN.getNamespace(), operation.name()).toString());
}
final boolean useOperationFQN = this.getClient().getConfiguration().isUseUrlOperationFQN();
EdmEntityType entityType = getClient().getCachedEdm().getEntityType(entity.getTypeName());
EdmEntityType baseType = entityType;
while (boundOp == null && baseType != null) {
// json minimal/none metadata doesn't return operations for entity, so here try creating it from Edm:
final EdmAction action = this.getClient().getCachedEdm().getBoundAction(
new FullQualifiedName(targetFQN.getNamespace(), operation.name()),
baseType.getFullQualifiedName(),
false);
if (action == null) {
baseType = baseType.getBaseType();
} else {
boundOp = new ClientOperation();
boundOp.setMetadataAnchor(action.getFullQualifiedName().toString());
boundOp.setTitle(boundOp.getMetadataAnchor());
boundOp.setTarget(URI.create(entityURI.toASCIIString() + "/"
+ (useOperationFQN ? action.getFullQualifiedName().toString() : operation.name())));
}
}
baseType = entityType;
while (boundOp == null && baseType != null) {
// json minimal/none metadata doesn't return operations for entity, so here try creating it from Edm:
final EdmFunction func = this.getClient().getCachedEdm().getBoundFunction(
new FullQualifiedName(targetFQN.getNamespace(), operation.name()), baseType.getFullQualifiedName(),
false, parameterNames);
if (func == null) {
baseType = baseType.getBaseType();
} else {
boundOp = new ClientOperation();
boundOp.setMetadataAnchor(func.getFullQualifiedName().toString());
boundOp.setTitle(boundOp.getMetadataAnchor());
boundOp.setTarget(URI.create(entityURI.toASCIIString() + "/"
+ (useOperationFQN ? func.getFullQualifiedName().toString() : operation.name())));
}
}
if (boundOp == null) {
throw new IllegalArgumentException(String.format("Could not find any matching operation '%s' bound to %s",
operation.name(), entity.getTypeName()));
}
final FullQualifiedName operationFQN = boundOp.getTitle().indexOf('.') == -1
? new FullQualifiedName(targetFQN.getNamespace(), boundOp.getTitle())
: new FullQualifiedName(boundOp.getTitle());
EdmOperation edmOperation = null;
while (edmOperation == null && entityType != null) {
edmOperation = operation.type() == OperationType.FUNCTION
? getClient().getCachedEdm().getBoundFunction(
operationFQN, entityType.getFullQualifiedName(), false, parameterNames)
: getClient().getCachedEdm().getBoundAction(
operationFQN, entityType.getFullQualifiedName(), false);
if (entityType.getBaseType() != null) {
entityType = entityType.getBaseType();
}
}
if (edmOperation == null) {
throw new IllegalArgumentException(String.format("Could not find any matching operation '%s' bound to %s",
operation.name(), entity.getTypeName()));
}
return new AbstractMap.SimpleEntry<URI, EdmOperation>(boundOp.getTarget(), edmOperation);
}