Package org.apache.olingo.odata2.api.edm.provider

Examples of org.apache.olingo.odata2.api.edm.provider.SimpleProperty


    if (NAMESPACE_1.equals(edmFQName.getNamespace())) {
      if (COMPLEX_TYPE_1.getName().equals(edmFQName.getName())) {
        List<Property> properties = new ArrayList<Property>();
        properties.add(new ComplexProperty().setName("City").setType(COMPLEX_TYPE_2).setFacets(
            new Facets().setNullable(false)));
        properties.add(new SimpleProperty().setName("Country").setType(EdmSimpleTypeKind.String));
        return new ComplexType().setName(COMPLEX_TYPE_1.getName()).setProperties(properties);

      } else if (COMPLEX_TYPE_2.getName().equals(edmFQName.getName())) {
        List<Property> properties = new ArrayList<Property>();
        properties.add(new SimpleProperty().setName("PostalCode").setType(EdmSimpleTypeKind.String));
        properties.add(new SimpleProperty().setName("CityName").setType(EdmSimpleTypeKind.String));
        return new ComplexType().setName(COMPLEX_TYPE_2.getName()).setProperties(properties);
      }
    }

    return null;
View Full Code Here


    return complexTypes;
  }

  private static List<Property> createComplexTypePropertiesTwo() {
    List<Property> properties = new ArrayList<Property>();
    SimpleProperty property = new SimpleProperty();
    property.setName("SoId");
    property.setType(EdmSimpleTypeKind.Int64);
    JPAEdmMapping mapping = new JPAEdmMappingImpl();
    mapping.setJPAColumnName("Sales_Order_Id");
    ((Mapping) mapping).setInternalName("SalesOrderItemKey.SoId");
    property.setMapping((Mapping) mapping);
    properties.add(property);
    property = new SimpleProperty();
    property.setName("LiId");
    property.setType(EdmSimpleTypeKind.Int64);
    mapping = new JPAEdmMappingImpl();
    mapping.setJPAColumnName("Sales_Order_Item_Id");
    property.setMapping((Mapping) mapping);
    properties.add(property);
    return properties;

  }
View Full Code Here

  }

  private static List<Property> createComplexTypePropertiesOne() {
    List<Property> properties = new ArrayList<Property>();
    SimpleProperty property = new SimpleProperty();
    property.setName("StreetName");
    property.setType(EdmSimpleTypeKind.String);
    JPAEdmMapping mapping = new JPAEdmMappingImpl();
    mapping.setJPAColumnName("STREET_NAME");
    property.setMapping((Mapping) mapping);
    properties.add(property);
    property = new SimpleProperty();
    property.setName("City");
    property.setType(EdmSimpleTypeKind.String);
    mapping = new JPAEdmMappingImpl();
    mapping.setJPAColumnName("CITY");
    property.setMapping((Mapping) mapping);
    properties.add(property);
    return properties;
  }
View Full Code Here

    mapping1.setJPAColumnName("LINEITEMID");
    ((Mapping) mapping1).setInternalName("LineItemKey.LiId");
    JPAEdmMapping mapping2 = new JPAEdmMappingImpl();
    mapping2.setJPAColumnName("LINEITEMNAME");
    ((Mapping) mapping2).setInternalName("LineItemKey.LiName");
    properties.add(new SimpleProperty().setName("LIID").setMapping((Mapping) mapping1));
    properties.add(new SimpleProperty().setName("LINAME").setMapping((Mapping) mapping2));
    complexType.setProperties(properties);
    List<Property> expandedList = null;
    try {
      objComplexType.expandEdmComplexType(complexType, expandedList, "SalesOrderItemKey");
    } catch (ClassCastException e) {
View Full Code Here

              assertNull(property.getFacets());
            }
          }
        } else if ("Photo".equals(entityType.getName())) {
          for (Property property : entityType.getProperties()) {
            SimpleProperty sProperty = (SimpleProperty) property;
            if ("Id".equals(property.getName())) {
              assertEquals(Boolean.FALSE, property.getFacets().isNullable());
              assertEquals(EdmConcurrencyMode.Fixed, property.getFacets().getConcurrencyMode());
              assertEquals(new Integer(MAX_LENGTH), property.getFacets().getMaxLength());

              assertEquals(EdmSimpleTypeKind.Int32, sProperty.getType());
              assertNull(property.getCustomizableFeedMappings());
            }
            if ("Name".equals(property.getName())) {
              assertEquals(Boolean.TRUE, property.getFacets().isUnicode());
              assertEquals(DEFAULT_VALUE, property.getFacets().getDefaultValue());
              assertEquals(Boolean.FALSE, property.getFacets().isFixedLength());
              assertEquals(EdmSimpleTypeKind.String, sProperty.getType());
              assertNull(property.getCustomizableFeedMappings());
            }
            if ("Содержание".equals(property.getName())) {
              assertEquals(FC_TARGET_PATH, property.getCustomizableFeedMappings().getFcTargetPath());
              assertEquals(FC_NS_URI, property.getCustomizableFeedMappings().getFcNsUri());
View Full Code Here

    EntityType fooEntityType = new EntityType().setName("fooEntityType").setNavigationProperties(navigationProperties);
    FullQualifiedName fooEntityTypeFullName = new FullQualifiedName("namespace", "fooEntityType");
    when(edmProvider.getEntityType(fooEntityTypeFullName)).thenReturn(fooEntityType);

    List<Property> keyPropertysFoo = new ArrayList<Property>();
    Property keyPropFoo = new SimpleProperty().setName("Id").setType(EdmSimpleTypeKind.String);
    keyPropertysFoo.add(keyPropFoo);
    fooEntityType.setProperties(keyPropertysFoo);

    PropertyRef refToKeyFoo = new PropertyRef().setName("Id");
    List<PropertyRef> propRefKeysFoo = new ArrayList<PropertyRef>();
    propRefKeysFoo.add(refToKeyFoo);

    Key fooTypeKey = new Key().setKeys(propRefKeysFoo);
    fooEntityType.setKey(fooTypeKey);

    edmEntityType = new EdmEntityTypeImplProv(edmImplProv, fooEntityType, "namespace");

    FullQualifiedName barBaseTypeName = new FullQualifiedName("namespace", "barBase");
    EntityType barBase = new EntityType().setName("barBase");
    when(edmProvider.getEntityType(barBaseTypeName)).thenReturn(barBase);

    List<NavigationProperty> navigationPropertiesBarBase = new ArrayList<NavigationProperty>();
    navigationPropertiesBarBase.add(new NavigationProperty().setName("barBaseNav"));
    barBase.setNavigationProperties(navigationPropertiesBarBase);

    List<Property> keyPropertysBarBase = new ArrayList<Property>();
    Property keyPropBarBase = new SimpleProperty().setName("Id").setType(EdmSimpleTypeKind.String);
    keyPropertysBarBase.add(keyPropBarBase);
    barBase.setProperties(keyPropertysBarBase);

    PropertyRef refToKeyBarBase = new PropertyRef().setName("Id");
    List<PropertyRef> propRefKeysBarBase = new ArrayList<PropertyRef>();
View Full Code Here

  }

  private List<Property> buildPropertiesB() {
    List<Property> propertyList = new ArrayList<Property>();

    SimpleProperty property = new SimpleProperty();
    property.setName(JPAEdmMockData.ComplexType.ComplexTypeB.Property.PROPERTY_D);
    property.setType(EdmSimpleTypeKind.Int16);

    propertyList.add(property);

    property = new SimpleProperty();
    property.setName(JPAEdmMockData.ComplexType.ComplexTypeB.Property.PROPERTY_E);
    property.setType(EdmSimpleTypeKind.Int16);

    propertyList.add(property);

    return propertyList;
  }
View Full Code Here

  private List<Property> buildPropertiesA() {

    List<Property> propertyList = new ArrayList<Property>();

    SimpleProperty property = new SimpleProperty();
    property.setName(JPAEdmMockData.ComplexType.ComplexTypeA.Property.PROPERTY_A);
    property.setType(EdmSimpleTypeKind.Int16);

    propertyList.add(property);

    property = new SimpleProperty();
    property.setName(JPAEdmMockData.ComplexType.ComplexTypeA.Property.PROPERTY_B);
    property.setType(EdmSimpleTypeKind.Int16);

    propertyList.add(property);

    ComplexProperty complexProperty = new ComplexProperty();
    complexProperty.setName(JPAEdmMockData.ComplexType.ComplexTypeA.Property.PROPERTY_C);
View Full Code Here

    // TODO think how to stop the recursion if A includes B and B includes A!!!!!!
    public void normalizeComplexKey(final ComplexType complexType, final List<PropertyRef> propertyRefList) {
      for (Property property : complexType.getProperties()) {
        try {

          SimpleProperty simpleProperty = (SimpleProperty) property;
          Facets facets = (Facets) simpleProperty.getFacets();
          if (facets == null) {
            simpleProperty.setFacets(new Facets().setNullable(false));
          } else {
            facets.setNullable(false);
          }
          PropertyRef propertyRef = new PropertyRef();
          propertyRef.setName(simpleProperty.getName());
          propertyRefList.add(propertyRef);

        } catch (ClassCastException e) {
          ComplexProperty complexProperty = (ComplexProperty) property;
          normalizeComplexKey(complexTypeView.searchEdmComplexType(complexProperty.getType()), propertyRefList);
View Full Code Here

    return property;
  }

  private Property readSimpleProperty(final XMLStreamReader reader, final FullQualifiedName fqName)
      throws XMLStreamException {
    SimpleProperty property = new SimpleProperty();
    property.setName(reader.getAttributeValue(null, XmlMetadataConstants.EDM_NAME));
    property.setType(EdmSimpleTypeKind.valueOf(fqName.getName()));
    return property;
  }
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.api.edm.provider.SimpleProperty

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.