本文整理汇总了Java中org.apache.olingo.commons.api.edm.provider.CsdlEntityType类的典型用法代码示例。如果您正苦于以下问题:Java CsdlEntityType类的具体用法?Java CsdlEntityType怎么用?Java CsdlEntityType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CsdlEntityType类属于org.apache.olingo.commons.api.edm.provider包,在下文中一共展示了CsdlEntityType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: updateTypesMapWithType
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
private <T extends CsdlAbstractEdmItem> void updateTypesMapWithType(T type, Map<FullQualifiedName, T> types) {
if (type != null) {
FullQualifiedName fqn;
if (type instanceof CsdlEntityType) {
fqn = FullQualifiedNamesUtil.createFullQualifiedEntityName(((CsdlEntityType) type).getName());
} else if (type instanceof CsdlEnumType) {
fqn = FullQualifiedNamesUtil.createFullQualifiedEnumName(((CsdlEnumType) type).getName());
} else if (type instanceof CsdlComplexType) {
fqn = FullQualifiedNamesUtil.createFullQualifiedComplexTypeName(((CsdlComplexType) type).getName());
} else {
throw new IllegalStateException("Unsupported CSDL Type");
}
types.put(fqn, type);
}
}
开发者ID:mat3e,项目名称:olingo-jpa,代码行数:17,代码来源:AbstractEdmProvider.java
示例2: test_JpaEntityCsdlProvider_getCsdlEntityType_returnsWhatDefined
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
@Test
public void test_JpaEntityCsdlProvider_getCsdlEntityType_returnsWhatDefined() throws CsdlExtractException {
// GIVEN
final JpaEntityCsdlProvider sut = new TestCsdlEntityProvider();
// WHEN
CsdlEntityType result = sut.getCsdlEntityType();
// THEN
assertThat(result.getName()).isEqualTo(NAME_1);
assertThat(result.hasStream()).isFalse();
assertThat(result.getKey()).hasSize(1);
assertThat(result.getKey().get(0).getName()).isEqualTo(ID_FIELD);
assertThat(result.getProperty(ID_FIELD).getType()).isEqualTo("Edm.String");
assertThat(result.getProperty(NAME_FIELD).getType()).isEqualTo("Edm.String");
}
开发者ID:mat3e,项目名称:olingo-jpa,代码行数:18,代码来源:JpaEntityCsdlProviderTest.java
示例3: getEntityType
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
@Override
public CsdlEntityType getEntityType(final FullQualifiedName edmFQName) throws ODataException {
String nameSpace = edmFQName.getNamespace();
try {
for (CsdlSchema schema : this.rdfEdmModelProvider.getEdmMetadata().getSchemas()) {
if (nameSpace.equals(schema.getNamespace())) {
String entityTypeName = edmFQName.getName();
for (CsdlEntityType entityType : schema.getEntityTypes()) {
if (entityTypeName.equals(entityType.getName())) {
return entityType;
}
}
}
}
} catch (NullPointerException e) {
log.error("NullPointerException getEntityType " + edmFQName);
throw new ODataException("NullPointerException getEntityType " + edmFQName);
}
return null;
}
开发者ID:peterjohnlawrence,项目名称:com.inova8.odata2sparql.v4,代码行数:22,代码来源:RdfEdmProvider.java
示例4: getEntityType
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
@Override
public CsdlEntityType getEntityType() {
// create EntityType properties
CsdlProperty id = new CsdlProperty().setName("CID")
.setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
CsdlProperty name = new CsdlProperty().setName("CName")
.setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
CsdlProperty description = new CsdlProperty().setName("CDescription")
.setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
// create CsdlPropertyRef for Key element
CsdlPropertyRef propertyRef = new CsdlPropertyRef();
propertyRef.setName("ID");
// configure EntityType
CsdlEntityType entityType = new CsdlEntityType();
entityType.setName(ET_COMPUTER_SYSTEM_NAME);
entityType.setProperties(Arrays.asList(id, name, description));
entityType.setKey(Collections.singletonList(propertyRef));
return entityType;
}
开发者ID:RedHelixOrg,项目名称:RedHelix-1,代码行数:26,代码来源:RedHxComputerSystemServiceEdmProvider.java
示例5: getEntityType
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
/**
*
*
* @return
*/
@Override
public CsdlEntityType getEntityType() {
// create EntityType properties
CsdlProperty id =
new CsdlProperty().setName("ID").setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
CsdlProperty name = new CsdlProperty().setName("Name")
.setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
CsdlProperty description = new CsdlProperty().setName("Description")
.setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
// create CsdlPropertyRef for Key element
CsdlPropertyRef propertyRef = new CsdlPropertyRef();
propertyRef.setName("ID");
// configure EntityType
CsdlEntityType entityType = new CsdlEntityType();
entityType.setName(ET_CHASSIS_NAME);
entityType.setProperties(Arrays.asList(id, name, description));
entityType.setKey(Collections.singletonList(propertyRef));
return entityType;
}
开发者ID:RedHelixOrg,项目名称:RedHelix-1,代码行数:30,代码来源:RedHxChassisServiceEdmProvider.java
示例6: hasStreamInherited
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
@Test
public void hasStreamInherited() throws Exception {
CsdlEdmProvider provider = mock(CsdlEdmProvider.class);
EdmProviderImpl edm = new EdmProviderImpl(provider);
FullQualifiedName baseName = new FullQualifiedName("namespace", "BaseTypeName");
CsdlEntityType baseType = new CsdlEntityType();
baseType.setHasStream(true);
when(provider.getEntityType(baseName)).thenReturn(baseType);
FullQualifiedName typeName = new FullQualifiedName("namespace", "typeName");
CsdlEntityType type = new CsdlEntityType();
type.setBaseType(baseName);
EdmEntityType typeWithBaseTypeWithStream = new EdmEntityTypeImpl(edm, typeName, type);
when(provider.getEntityType(typeName)).thenReturn(type);
assertTrue(typeWithBaseTypeWithStream.hasStream());
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:19,代码来源:EdmEntityTypeImplTest.java
示例7: navigationProperty
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
@Test
public void navigationProperty() throws Exception {
CsdlEdmProvider provider = mock(CsdlEdmProvider.class);
EdmProviderImpl edm = new EdmProviderImpl(provider);
final FullQualifiedName entityTypeName = new FullQualifiedName("ns", "entity");
CsdlEntityType entityTypeProvider = new CsdlEntityType();
entityTypeProvider.setKey(Collections.<CsdlPropertyRef> emptyList());
when(provider.getEntityType(entityTypeName)).thenReturn(entityTypeProvider);
CsdlNavigationProperty propertyProvider = new CsdlNavigationProperty();
propertyProvider.setType(entityTypeName);
propertyProvider.setNullable(false);
EdmNavigationProperty property = new EdmNavigationPropertyImpl(edm, propertyProvider);
assertFalse(property.isCollection());
assertFalse(property.isNullable());
EdmType type = property.getType();
assertEquals(EdmTypeKind.ENTITY, type.getKind());
assertEquals("ns", type.getNamespace());
assertEquals("entity", type.getName());
assertNull(property.getReferencingPropertyName("referencedPropertyName"));
assertNull(property.getPartner());
assertFalse(property.containsTarget());
// Test caching
EdmType cachedType = property.getType();
assertTrue(type == cachedType);
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:EdmNavigationPropertyImplTest.java
示例8: navigationPropertyWithPartner
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
@Test
public void navigationPropertyWithPartner() throws Exception {
CsdlEdmProvider provider = mock(CsdlEdmProvider.class);
EdmProviderImpl edm = new EdmProviderImpl(provider);
final FullQualifiedName entityTypeName = new FullQualifiedName("ns", "entity");
CsdlEntityType entityTypeProvider = new CsdlEntityType();
entityTypeProvider.setKey(Collections.<CsdlPropertyRef> emptyList());
List<CsdlNavigationProperty> navigationProperties = new ArrayList<CsdlNavigationProperty>();
navigationProperties.add(new CsdlNavigationProperty().setName("partnerName").setType(entityTypeName));
entityTypeProvider.setNavigationProperties(navigationProperties);
when(provider.getEntityType(entityTypeName)).thenReturn(entityTypeProvider);
CsdlNavigationProperty propertyProvider = new CsdlNavigationProperty();
propertyProvider.setType(entityTypeName);
propertyProvider.setNullable(false);
propertyProvider.setPartner("partnerName");
EdmNavigationProperty property = new EdmNavigationPropertyImpl(edm, propertyProvider);
EdmNavigationProperty partner = property.getPartner();
assertNotNull(partner);
// Caching
assertTrue(partner == property.getPartner());
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:24,代码来源:EdmNavigationPropertyImplTest.java
示例9: navigationPropertyWithNonexistentPartner
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
@Test(expected = EdmException.class)
public void navigationPropertyWithNonexistentPartner() throws Exception {
CsdlEdmProvider provider = mock(CsdlEdmProvider.class);
EdmProviderImpl edm = new EdmProviderImpl(provider);
final FullQualifiedName entityTypeName = new FullQualifiedName("ns", "entity");
CsdlEntityType entityTypeProvider = new CsdlEntityType();
entityTypeProvider.setKey(Collections.<CsdlPropertyRef> emptyList());
List<CsdlNavigationProperty> navigationProperties = new ArrayList<CsdlNavigationProperty>();
navigationProperties.add(new CsdlNavigationProperty().setName("partnerName").setType(entityTypeName));
entityTypeProvider.setNavigationProperties(navigationProperties);
when(provider.getEntityType(entityTypeName)).thenReturn(entityTypeProvider);
CsdlNavigationProperty propertyProvider = new CsdlNavigationProperty();
propertyProvider.setType(entityTypeName);
propertyProvider.setNullable(false);
propertyProvider.setPartner("wrong");
EdmNavigationProperty property = new EdmNavigationPropertyImpl(edm, propertyProvider);
property.getPartner();
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:20,代码来源:EdmNavigationPropertyImplTest.java
示例10: getEntityType
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
@Override
public CsdlEntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
if (entityTypeName.equals(nameETAbstract)) {
return new CsdlEntityType()
.setName("ETAbstract")
.setAbstract(true)
.setProperties(Collections.singletonList(propertyString));
} else if (entityTypeName.equals(nameETAbstractBase)) {
return new CsdlEntityType()
.setName("ETAbstractBase")
.setBaseType(nameETAbstract)
.setKey(Collections.singletonList(new CsdlPropertyRef().setName("PropertyInt16")))
.setProperties(Collections.singletonList(propertyInt16_NotNullable));
}
return null;
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:18,代码来源:MetadataDocumentXmlSerializerTest.java
示例11: readEntityType
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
private void readEntityType(XMLEventReader reader, StartElement element, CsdlSchema schema)
throws XMLStreamException {
CsdlEntityType entityType = new CsdlEntityType();
entityType.setProperties(new ArrayList<CsdlProperty>());
entityType.setNavigationProperties(new ArrayList<CsdlNavigationProperty>());
entityType.setKey(new ArrayList<CsdlPropertyRef>());
entityType.setName(attr(element, "Name"));
if (attr(element, "BaseType") != null) {
entityType.setBaseType(new FullQualifiedName(attr(element, "BaseType")));
}
entityType.setAbstract(Boolean.parseBoolean(attr(element, "Abstract")));
entityType.setOpenType(Boolean.parseBoolean(attr(element, "OpenType")));
entityType.setHasStream(Boolean.parseBoolean(attr(element, "HasStream")));
readEntityProperties(reader, entityType);
schema.getEntityTypes().add(entityType);
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:17,代码来源:MetadataParser.java
示例12: validateCsdlEntityTypes
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
/**
* This method validates Csdl Entity types.
* Looks for correct namespace aliases and correct base types
*/
private void validateCsdlEntityTypes() {
for (Map.Entry<FullQualifiedName, CsdlEntityType> entityTypes : csdlEntityTypesMap.entrySet()) {
if (entityTypes.getValue() != null && entityTypes.getKey() != null) {
CsdlEntityType entityType = entityTypes.getValue();
if (entityType.getBaseType() != null) {
CsdlEntityType baseEntityType;
FullQualifiedName baseTypeFQName = entityType.getBaseTypeFQN();
if (!csdlEntityTypesMap.containsKey(baseTypeFQName)) {
FullQualifiedName fqName = validateCsdlEntityTypeWithAlias(baseTypeFQName);
baseEntityType = fetchLastCsdlBaseType(fqName);
} else {
baseEntityType = fetchLastCsdlBaseType(baseTypeFQName);
}
if (baseEntityType != null && (baseEntityType.getKey() == null ||
baseEntityType.getKey().isEmpty())) {
throw new RuntimeException("Missing key for EntityType " + baseEntityType.getName());
}
} else if (entityType.getKey() == null || entityType.getKey().isEmpty()) {
throw new RuntimeException("Missing key for EntityType " + entityType.getName());
}
}
}
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:28,代码来源:CsdlTypeValidator.java
示例13: fetchLastCsdlBaseType
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
/**
* This fetches the last Base Type entity from a hierarchy of base type derived types
* @param baseTypeFQName
* @return CsdlEntityType
*/
private CsdlEntityType fetchLastCsdlBaseType(FullQualifiedName baseTypeFQName) {
CsdlEntityType baseEntityType = null;
while (baseTypeFQName != null) {
if (!(csdlEntityTypesMap.containsKey(baseTypeFQName))) {
baseTypeFQName = validateCsdlEntityTypeWithAlias(baseTypeFQName);
}
baseEntityType = csdlEntityTypesMap.get(baseTypeFQName);
if (baseEntityType != null) {
if (baseEntityType.getKey() != null) {
break;
} else if (baseEntityType.getBaseType() != null) {
baseTypeFQName = baseEntityType.getBaseTypeFQN();
} else if (baseEntityType.getBaseType() == null) {
break;
}
}
}
return baseEntityType;
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:25,代码来源:CsdlTypeValidator.java
示例14: fetchLastBaseEntityHavingNavigationProperty
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
/**
* This fetches the last Base Type entity from a hierarchy of base type derived types
* @param baseTypeFQName
* @return CsdlNavigationProperty
*/
private CsdlNavigationProperty fetchLastBaseEntityHavingNavigationProperty(
FullQualifiedName baseTypeFQName, String navBindingProperty) {
CsdlEntityType baseEntityType = null;
while (baseTypeFQName != null) {
if (!(csdlEntityTypesMap.containsKey(baseTypeFQName))) {
baseTypeFQName = validateCsdlEntityTypeWithAlias(baseTypeFQName);
}
baseEntityType = csdlEntityTypesMap.get(baseTypeFQName);
if (baseEntityType != null) {
if (baseEntityType.getNavigationProperty(navBindingProperty) != null) {
break;
} else if (baseEntityType.getBaseType() != null) {
baseTypeFQName = baseEntityType.getBaseTypeFQN();
} else if (baseEntityType.getBaseType() == null) {
break;
}
}
}
if (baseEntityType == null) {
throw new RuntimeException("Entity Type is null with fully qualified name:" + baseTypeFQName);
}
return baseEntityType.getNavigationProperty(navBindingProperty);
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:29,代码来源:CsdlTypeValidator.java
示例15: fetchNavigationProperty
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
/**
* fetch the actual navigation property from the remaning path
* @param remainingPath
* @param strNavProperty
* @param sourceTypeHavingNavProp
* @return CsdlNavigationProperty
*/
private CsdlNavigationProperty fetchNavigationProperty(String remainingPath,
String strNavProperty, CsdlStructuralType sourceTypeHavingNavProp) {
String[] paths = remainingPath.split("/");
for (String path : paths) {
FullQualifiedName fqName = null;
if (sourceTypeHavingNavProp instanceof CsdlComplexType) {
fqName = ((CsdlComplexType)sourceTypeHavingNavProp).getProperty(path).getTypeAsFQNObject();
} else if (sourceTypeHavingNavProp instanceof CsdlEntityType) {
fqName = ((CsdlEntityType)sourceTypeHavingNavProp).getProperty(path).getTypeAsFQNObject();
}
if (fqName != null) {
String namespace = aliasNamespaceMap.get(fqName.getNamespace());
fqName = namespace != null ? new FullQualifiedName(namespace, fqName.getName()) : fqName;
}
sourceTypeHavingNavProp = csdlEntityTypesMap.get(fqName) != null ?
csdlEntityTypesMap.get(fqName) :
csdlComplexTypesMap.get(fqName);
}
return sourceTypeHavingNavProp.getNavigationProperty(strNavProperty);
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:29,代码来源:CsdlTypeValidator.java
示例16: getSchemas
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
@Override
public List<CsdlSchema> getSchemas() {
// create Schema
CsdlSchema schema = new CsdlSchema();
schema.setNamespace(NAMESPACE);
// add EntityTypes
List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
entityTypes.add(getEntityType(ET_PRODUCT_FQN));
schema.setEntityTypes(entityTypes);
// add EntityContainer
schema.setEntityContainer(getEntityContainer());
// finally
List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
schemas.add(schema);
return schemas;
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:22,代码来源:DemoEdmProvider.java
示例17: getEntityType
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
@Override
public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) {
// this method is called for one of the EntityTypes that are configured in the Schema
if(ET_PRODUCT_FQN.equals(entityTypeName)){
//create EntityType properties
CsdlProperty id = new CsdlProperty().setName("ID").setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
CsdlProperty name = new CsdlProperty().setName("Name").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
CsdlProperty description = new CsdlProperty().setName("Description").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
// create PropertyRef for Key element
CsdlPropertyRef propertyRef = new CsdlPropertyRef();
propertyRef.setName("ID");
// configure EntityType
CsdlEntityType entityType = new CsdlEntityType();
entityType.setName(ET_PRODUCT_NAME);
entityType.setProperties(Arrays.asList(id, name, description));
entityType.setKey(Collections.singletonList(propertyRef));
return entityType;
}
return null;
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:DemoEdmProvider.java
示例18: getSchemas
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
@Override
public List<CsdlSchema> getSchemas() {
// create Schema
CsdlSchema schema = new CsdlSchema();
schema.setNamespace(NAMESPACE);
// add EntityTypes
List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
entityTypes.add(getEntityType(ET_PRODUCT_FQN));
entityTypes.add(getEntityType(ET_CATEGORY_FQN));
schema.setEntityTypes(entityTypes);
// add EntityContainer
schema.setEntityContainer(getEntityContainer());
// finally
List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
schemas.add(schema);
return schemas;
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:23,代码来源:DemoEdmProvider.java
示例19: getSchemas
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
@Override
public List<CsdlSchema> getSchemas() {
// create Schema
CsdlSchema schema = new CsdlSchema();
schema.setNamespace(NAMESPACE);
// add EntityTypes
List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
entityTypes.add(getEntityType(ET_PRODUCT_FQN));
entityTypes.add(getEntityType(ET_CATEGORY_FQN));
entityTypes.add(getEntityType(ET_ADVERTISEMENT_FQN));
schema.setEntityTypes(entityTypes);
// add EntityContainer
schema.setEntityContainer(getEntityContainer());
// finally
List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
schemas.add(schema);
return schemas;
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:24,代码来源:DemoEdmProvider.java
示例20: getSchemas
import org.apache.olingo.commons.api.edm.provider.CsdlEntityType; //导入依赖的package包/类
@Override
public List<CsdlSchema> getSchemas() {
// create Schema
CsdlSchema schema = new CsdlSchema();
schema.setNamespace(NAMESPACE);
// add EntityTypes
List<CsdlEntityType> entityTypes = new ArrayList<CsdlEntityType>();
entityTypes.add(getEntityType(ET_PRODUCT_FQN));
entityTypes.add(getEntityType(ET_CATEGORY_FQN));
schema.setEntityTypes(entityTypes);
// add EntityContainer
schema.setEntityContainer(getEntityContainer());
// finally
List<CsdlSchema> schemas = new ArrayList<CsdlSchema>();
schemas.add(schema);
return schemas;
}
开发者ID:apache,项目名称:olingo-odata4,代码行数:22,代码来源:DemoEdmProvider.java
注:本文中的org.apache.olingo.commons.api.edm.provider.CsdlEntityType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论