本文整理汇总了Java中org.apache.olingo.odata2.api.edm.provider.Schema.getComplexTypes方法的典型用法代码示例。如果您正苦于以下问题:Java Schema.getComplexTypes方法的具体用法?Java Schema.getComplexTypes怎么用?Java Schema.getComplexTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.olingo.odata2.api.edm.provider.Schema
的用法示例。
在下文中一共展示了Schema.getComplexTypes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getComplexType
import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@Override
public ComplexType getComplexType(final FullQualifiedName edmFQName) throws ODataException {
Schema schema = namespace2Schema.get(edmFQName.getNamespace());
if (schema != null) {
List<ComplexType> complexTypes = schema.getComplexTypes();
for (ComplexType complexType : complexTypes) {
if (complexType.getName().equals(edmFQName.getName())) {
return complexType;
}
}
}
return null;
}
示例2: getComplexType
import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@Override
public ComplexType getComplexType(final FullQualifiedName edmFQName) throws ODataException {
if (edmFQName != null) {
if (complexTypes.containsKey(edmFQName.toString())) {
return complexTypes.get(edmFQName.toString());
} else if (schemas == null) {
getSchemas();
}
for (Schema schema : schemas) {
if (schema.getNamespace().equals(edmFQName.getNamespace())) {
if (schema.getComplexTypes() == null) {
return null;
}
for (ComplexType ct : schema.getComplexTypes()) {
if (ct.getName().equals(edmFQName.getName())) {
complexTypes.put(edmFQName.toString(), ct);
return ct;
}
}
}
}
}
return null;
}
示例3: getComplexType
import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@Override
public ComplexType getComplexType(final FullQualifiedName edmFQName) throws ODataException {
for (Schema schema : dataServices.getSchemas()) {
if (schema.getNamespace().equals(edmFQName.getNamespace())) {
for (ComplexType complexType : schema.getComplexTypes()) {
if (complexType.getName().equals(edmFQName.getName())) {
return complexType;
}
}
}
}
return null;
}
示例4: testComplexTypeWithBaseType
import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@Test
public void testComplexTypeWithBaseType() throws XMLStreamException, EntityProviderException {
final String xml =
"<edmx:Edmx Version=\"1.0\" xmlns:edmx=\"" + Edm.NAMESPACE_EDMX_2007_06 + "\">"
+ "<edmx:DataServices m:DataServiceVersion=\"2.0\" xmlns:m=\"" + Edm.NAMESPACE_M_2007_08 + "\">"
+ "<Schema Namespace=\"" + NAMESPACE + "\" Alias=\"RS\" xmlns=\"" + Edm.NAMESPACE_EDM_2008_09 + "\">"
+ "<EntityType Name= \"Employee\" m:HasStream=\"true\">" + "<Key><PropertyRef Name=\"EmployeeId\"/></Key>"
+ "<Property Name=\"" + propertyNames[0] + "\" Type=\"Edm.String\" Nullable=\"false\"/>"
+ "<Property Name=\"" + propertyNames[2] + "\" Type=\"RefScenario.c_Location\" Nullable=\"false\"/>"
+ "</EntityType>" + "<ComplexType Name=\"c_BaseType_for_Location\" Abstract=\"true\">"
+ "<Property Name=\"Country\" Type=\"Edm.String\"/>" + "</ComplexType>"
+ "<ComplexType Name=\"c_Location\" BaseType=\"RefScenario.c_BaseType_for_Location\">" + "</ComplexType>"
+ "<ComplexType Name=\"c_Other_Location\" BaseType=\"RS.c_BaseType_for_Location\">" + "</ComplexType>"
+ "</Schema>"
+ "</edmx:DataServices>" + "</edmx:Edmx>";
XmlMetadataConsumer parser = new XmlMetadataConsumer();
XMLStreamReader reader = createStreamReader(xml);
DataServices result = parser.readMetadata(reader, true);
assertEquals("2.0", result.getDataServiceVersion());
for (Schema schema : result.getSchemas()) {
for (ComplexType complexType : schema.getComplexTypes()) {
if ("c_Location".equals(complexType.getName())) {
assertNotNull(complexType.getBaseType());
assertTrue(!complexType.isAbstract());
assertEquals("c_BaseType_for_Location", complexType.getBaseType().getName());
assertEquals("RefScenario", complexType.getBaseType().getNamespace());
} else if ("c_Other_Location".equals(complexType.getName())) {
assertNotNull(complexType.getBaseType());
assertTrue(!complexType.isAbstract());
assertEquals("c_BaseType_for_Location", complexType.getBaseType().getName());
assertEquals("RS", complexType.getBaseType().getNamespace());
} else if ("c_BaseType_for_Location".equals(complexType.getName())) {
assertNotNull(complexType.isAbstract());
assertTrue(complexType.isAbstract());
} else {
assertTrue(false);
}
}
}
}