当前位置: 首页>>代码示例>>Java>>正文


Java CsdlNavigationProperty.setPartner方法代码示例

本文整理汇总了Java中org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty.setPartner方法的典型用法代码示例。如果您正苦于以下问题:Java CsdlNavigationProperty.setPartner方法的具体用法?Java CsdlNavigationProperty.setPartner怎么用?Java CsdlNavigationProperty.setPartner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty的用法示例。


在下文中一共展示了CsdlNavigationProperty.setPartner方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: navigationPropertyWithPartner

import org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty; //导入方法依赖的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

示例2: navigationPropertyWithNonexistentPartner

import org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty; //导入方法依赖的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

示例3: doDeserialize

import org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty; //导入方法依赖的package包/类
@Override
protected CsdlNavigationProperty doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
        throws IOException {

  final CsdlNavigationProperty property = new ClientCsdlNavigationProperty();

  for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
    final JsonToken token = jp.getCurrentToken();
    if (token == JsonToken.FIELD_NAME) {
      if ("Name".equals(jp.getCurrentName())) {
        property.setName(jp.nextTextValue());
      } else if ("Type".equals(jp.getCurrentName())) {
        String metadataTypeName = jp.nextTextValue();
        if (metadataTypeName.startsWith("Collection(")) {
          property.setType(metadataTypeName.substring(metadataTypeName.indexOf("(") + 1,
                  metadataTypeName.length() - 1));
          property.setCollection(true);
        } else {
          property.setType(metadataTypeName);
          property.setCollection(false);
        }
      } else if ("Nullable".equals(jp.getCurrentName())) {
        property.setNullable(BooleanUtils.toBoolean(jp.nextTextValue()));
      } else if ("Partner".equals(jp.getCurrentName())) {
        property.setPartner(jp.nextTextValue());
      } else if ("ContainsTarget".equals(jp.getCurrentName())) {
        property.setContainsTarget(BooleanUtils.toBoolean(jp.nextTextValue()));
      } else if ("ReferentialConstraint".equals(jp.getCurrentName())) {
        jp.nextToken();
        property.getReferentialConstraints().add(jp.readValueAs(ClientCsdlReferentialConstraint.class));
      } else if ("OnDelete".equals(jp.getCurrentName())) {
        jp.nextToken();
        property.setOnDelete(jp.readValueAs(ClientCsdlOnDelete.class));
      } else if ("Annotation".equals(jp.getCurrentName())) {
        jp.nextToken();
        property.getAnnotations().add(jp.readValueAs(ClientCsdlAnnotation.class));
      }
    }
  }
  return property;
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:42,代码来源:ClientCsdlNavigationProperty.java


注:本文中的org.apache.olingo.commons.api.edm.provider.CsdlNavigationProperty.setPartner方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。