本文整理汇总了Java中org.apache.olingo.odata2.api.edm.provider.Schema.getEntityTypes方法的典型用法代码示例。如果您正苦于以下问题:Java Schema.getEntityTypes方法的具体用法?Java Schema.getEntityTypes怎么用?Java Schema.getEntityTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.olingo.odata2.api.edm.provider.Schema
的用法示例。
在下文中一共展示了Schema.getEntityTypes方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extendJPAEdmSchema
import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@Override
public void extendJPAEdmSchema(JPAEdmSchemaView view) {
ResourceBundle i18n = ODataContextUtil.getResourceBundle("i18n");
final Schema edmSchema = view.getEdmSchema();
for (EntityType entityType : edmSchema.getEntityTypes()) {
for (Property property : entityType.getProperties()) {
String label = null;
if (i18n != null) { try { label = i18n.getString(entityType.getName() + "." + property.getName()); } catch (Exception e) {} }
List<AnnotationAttribute> annotationAttributeList = new ArrayList<AnnotationAttribute>();
if (label != null) {
annotationAttributeList.add(new AnnotationAttribute()
.setNamespace(SAP_NAMESPACE)
.setPrefix(SAP_PREFIX)
.setName(LABEL).setText(label));
}
annotationAttributeList.addAll(getSapPropertyAnnotations(entityType, property));
property.setAnnotationAttributes(annotationAttributeList);
}
}
addSmartAnnotations(edmSchema);
}
示例2: testAlias
import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@Test()
public void testAlias() 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\">" + "<Key><PropertyRef Name=\"EmployeeId\"/></Key>" + "<Property Name=\""
+ propertyNames[0] + "\" Type=\"Edm.String\" Nullable=\"false\"/>" + "</EntityType>"
+ "<EntityType Name=\"Manager\" BaseType=\"RS.Employee\" m:HasStream=\"true\">" + "</EntityType>"
+ "</Schema>" + "</edmx:DataServices>" + "</edmx:Edmx>";
XmlMetadataConsumer parser = new XmlMetadataConsumer();
XMLStreamReader reader = createStreamReader(xml);
DataServices result = parser.readMetadata(reader, true);
for (Schema schema : result.getSchemas()) {
assertEquals("RS", schema.getAlias());
for (EntityType entityType : schema.getEntityTypes()) {
if ("Manager".equals(entityType.getName())) {
assertEquals("Employee", entityType.getBaseType().getName());
assertEquals("RS", entityType.getBaseType().getNamespace());
}
}
}
}
示例3: getEntityType
import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
private EntityType getEntityType(Schema edmSchema, FullQualifiedName entityType) {
for (EntityType e : edmSchema.getEntityTypes()) {
if (entityType.equals(new FullQualifiedName(edmSchema.getNamespace(), e.getName()))) {
return e;
}
}
return null;
}
示例4: getEntityType
import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@Override
public EntityType getEntityType(final FullQualifiedName edmFQName) throws ODataException {
Schema schema = namespace2Schema.get(edmFQName.getNamespace());
if (schema != null) {
List<EntityType> complexTypes = schema.getEntityTypes();
for (EntityType complexType : complexTypes) {
if (complexType.getName().equals(edmFQName.getName())) {
return complexType;
}
}
}
return null;
}
示例5: getEntityType
import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@Override
public EntityType getEntityType(final FullQualifiedName edmFQName) throws ODataException {
String strEdmFQName = null;
if (edmFQName != null) {
strEdmFQName = edmFQName.toString();
if (entityTypes.containsKey(strEdmFQName)) {
return entityTypes.get(strEdmFQName);
} else if (schemas == null) {
getSchemas();
}
String entityTypeNamespace = edmFQName.getNamespace();
String entityTypeName = edmFQName.getName();
for (Schema schema : schemas) {
String schemaNamespace = schema.getNamespace();
if (schemaNamespace.equals(entityTypeNamespace)) {
if (schema.getEntityTypes() == null) {
return null;
}
for (EntityType et : schema.getEntityTypes()) {
if (et.getName().equals(entityTypeName)) {
entityTypes.put(strEdmFQName, et);
return et;
}
}
}
}
}
return null;
}
示例6: calculateDataServiceVersion
import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
/**
* Calculates the necessary data service version for the metadata serialization
* @param schemas
* @return DataServiceversion as String
*/
private String calculateDataServiceVersion(final List<Schema> schemas) {
String dataServiceVersion = ODataServiceVersion.V10;
if (schemas != null) {
for (Schema schema : schemas) {
List<EntityType> entityTypes = schema.getEntityTypes();
if (entityTypes != null) {
for (EntityType entityType : entityTypes) {
List<Property> properties = entityType.getProperties();
if (properties != null) {
for (Property property : properties) {
if (property.getCustomizableFeedMappings() != null) {
if (property.getCustomizableFeedMappings().getFcKeepInContent() != null) {
if (!property.getCustomizableFeedMappings().getFcKeepInContent()) {
dataServiceVersion = ODataServiceVersion.V20;
return dataServiceVersion;
}
}
}
}
if (entityType.getCustomizableFeedMappings() != null) {
if (entityType.getCustomizableFeedMappings().getFcKeepInContent() != null) {
if (entityType.getCustomizableFeedMappings().getFcKeepInContent()) {
dataServiceVersion = ODataServiceVersion.V20;
return dataServiceVersion;
}
}
}
}
}
}
}
}
return dataServiceVersion;
}
示例7: getEntityType
import org.apache.olingo.odata2.api.edm.provider.Schema; //导入方法依赖的package包/类
@Override
public EntityType getEntityType(final FullQualifiedName edmFQName) throws ODataException {
for (Schema schema : dataServices.getSchemas()) {
if (schema.getNamespace().equals(edmFQName.getNamespace())) {
for (EntityType entityType : schema.getEntityTypes()) {
if (entityType.getName().equals(edmFQName.getName())) {
return entityType;
}
}
}
}
return null;
}