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

Examples of org.apache.olingo.odata2.api.edm.EdmNavigationProperty


  private <T> void createInlinedEntities(final EdmEntitySet entitySet, final T data, final ODataEntry entryValues)
      throws ODataException {
    final EdmEntityType entityType = entitySet.getEntityType();
    for (final String navigationPropertyName : entityType.getNavigationPropertyNames()) {

      final EdmNavigationProperty navigationProperty =
          (EdmNavigationProperty) entityType.getProperty(navigationPropertyName);
      final EdmEntitySet relatedEntitySet = entitySet.getRelatedEntitySet(navigationProperty);
      final EdmEntityType relatedEntityType = relatedEntitySet.getEntityType();

      final Object relatedValue = entryValues.getProperties().get(navigationPropertyName);
View Full Code Here


    when(uriInfo.getFilter()).thenReturn(filter);
    final OrderByExpression orderBy = UriParser.parseOrderBy(null, null, "true");
    when(uriInfo.getOrderBy()).thenReturn(orderBy);
    List<ArrayList<NavigationPropertySegment>> expand = new ArrayList<ArrayList<NavigationPropertySegment>>();
    NavigationPropertySegment segment = mock(NavigationPropertySegment.class);
    EdmNavigationProperty navigationProperty = mock(EdmNavigationProperty.class);
    when(navigationProperty.getName()).thenReturn("nav");
    when(segment.getNavigationProperty()).thenReturn(navigationProperty);
    ArrayList<NavigationPropertySegment> segments = new ArrayList<NavigationPropertySegment>();
    segments.add(segment);
    expand.add(segments);
    when(uriInfo.getExpand()).thenReturn(expand);
View Full Code Here

  public void setUp(final boolean toThrowException) throws Exception {
    entityUriInfo = EasyMock.createMock(GetEntityUriInfo.class);
    EdmEntitySet edmEntitySet = EasyMock.createMock(EdmEntitySet.class);
    EdmEntityType edmEntityType = EasyMock.createMock(EdmEntityType.class);
    List<NavigationSegment> navigationSegments = new ArrayList<NavigationSegment>();
    final EdmNavigationProperty navigationProperty = createNavigationProperty("a");
    final EdmNavigationProperty navigationProperty1 = createNavigationProperty("b");
    final List<KeyPredicate> keyPredicates = createKeyPredicates(toThrowException);
    NavigationSegment navigationSegment = new NavigationSegment() {

      @Override
      public EdmNavigationProperty getNavigationProperty() {
View Full Code Here

      assertTrue(true);
    }
  }

  private EdmNavigationProperty createNavigationProperty(final String z) throws EdmException {
    EdmNavigationProperty navigationProperty = EasyMock.createMock(EdmNavigationProperty.class);
    EdmAssociation association = EasyMock.createMock(EdmAssociation.class);
    EdmAssociationEnd associationEnd = EasyMock.createMock(EdmAssociationEnd.class);
    EasyMock.expect(navigationProperty.getFromRole()).andStubReturn("roleA" + z);
    EasyMock.expect(navigationProperty.getToRole()).andStubReturn("roleB" + z);
    EasyMock.expect(navigationProperty.getName()).andStubReturn("navP" + z);
    EasyMock.expect(navigationProperty.getName()).andStubReturn("navP" + z);
    EasyMock.expect(navigationProperty.getMultiplicity()).andStubReturn(EdmMultiplicity.ONE);
    EdmEntityType edmEntityType = EasyMock.createMock(EdmEntityType.class);
    EdmMapping edmMapping = EasyMock.createMock(EdmMapping.class);
    EasyMock.expect(edmMapping.getInternalName()).andStubReturn("sItem" + z);
    EasyMock.expect(edmEntityType.getMapping()).andStubReturn(edmMapping);
    EasyMock.expect(edmEntityType.getName()).andStubReturn("soItem" + z);
    EasyMock.expect(associationEnd.getEntityType()).andStubReturn(edmEntityType);
    EasyMock.expect(association.getEnd("roleA" + z)).andStubReturn(associationEnd);
    EasyMock.expect(navigationProperty.getRelationship()).andStubReturn(association);
    EdmMapping edmMapping1 = EasyMock.createMock(EdmMapping.class);
    EasyMock.expect(edmMapping1.getInternalName()).andStubReturn("s_Item" + z);
    EasyMock.expect(navigationProperty.getMapping()).andStubReturn(edmMapping1);
    EasyMock.replay(edmMapping, edmMapping1, edmEntityType, associationEnd, association, navigationProperty);
    return navigationProperty;
  }
View Full Code Here

    if (eia.getExpandedNavigationPropertyNames().contains(navigationPropertyName)) {
      if (properties.getCallbacks() != null && properties.getCallbacks().containsKey(navigationPropertyName)) {
        writer.writeStartElement(Edm.NAMESPACE_M_2007_08, FormatXml.M_INLINE);

        EdmNavigationProperty navProp = (EdmNavigationProperty) eia.getEntityType().getProperty(navigationPropertyName);
        WriteFeedCallbackContext context = new WriteFeedCallbackContext();
        context.setSourceEntitySet(eia.getEntitySet());
        context.setNavigationProperty(navProp);
        context.setEntryData(data);
        ExpandSelectTreeNode subNode = properties.getExpandSelectTree().getLinks().get(navigationPropertyName);
View Full Code Here

    if (eia.getExpandedNavigationPropertyNames().contains(navigationPropertyName)) {
      if (properties.getCallbacks() != null && properties.getCallbacks().containsKey(navigationPropertyName)) {
        writer.writeStartElement(Edm.NAMESPACE_M_2007_08, FormatXml.M_INLINE);

        EdmNavigationProperty navProp = (EdmNavigationProperty) eia.getEntityType().getProperty(navigationPropertyName);
        WriteEntryCallbackContext context = new WriteEntryCallbackContext();
        context.setSourceEntitySet(eia.getEntitySet());
        context.setNavigationProperty(navProp);
        context.setEntryData(data);
        ExpandSelectTreeNode subNode = properties.getExpandSelectTree().getLinks().get(navigationPropertyName);
View Full Code Here

      final List<String> propertyNames) throws EntityProviderException {
    try {
      Map<String, NavigationPropertyInfo> infos = new HashMap<String, NavigationPropertyInfo>();

      for (String propertyName : propertyNames) {
        EdmNavigationProperty navProperty = (EdmNavigationProperty) type.getProperty(propertyName);
        NavigationPropertyInfo info = NavigationPropertyInfo.create(navProperty);
        infos.put(propertyName, info);
      }

      return infos;
View Full Code Here

      jpaOuterJoinClauses.add(jpaOuterJoinClause);

      for (NavigationSegment navigationSegment : entitySetView.getNavigationSegments()) {

        EdmNavigationProperty navigationProperty = navigationSegment.getNavigationProperty();

        String relationShipAlias = generateRelationShipAlias();

        joinCondition =
            ODataExpressionParser.parseKeyPredicates(navigationSegment.getKeyPredicates(), relationShipAlias);
View Full Code Here

    Map<String, Object> entry = context.getEntryData();
    Map<String, Object> edmPropertyValueMap = null;
    List<EdmNavigationProperty> currentNavPropertyList = null;
    Map<String, ExpandSelectTreeNode> navigationLinks = null;
    JPAEntityParser jpaResultParser = new JPAEntityParser();
    EdmNavigationProperty currentNavigationProperty = context.getNavigationProperty();
    try {
      Object inlinedEntry = entry.get(currentNavigationProperty.getName());
      if (nextEntitySet == null) {
        nextEntitySet = context.getSourceEntitySet().getRelatedEntitySet(currentNavigationProperty);
      }
      edmPropertyValueMap = jpaResultParser.parse2EdmPropertyValueMap(inlinedEntry, nextEntitySet.getEntityType());
      result.setEntryData(edmPropertyValueMap);
      navigationLinks = context.getCurrentExpandSelectTreeNode().getLinks();
      if (navigationLinks.size() > 0) {
        currentNavPropertyList = new ArrayList<EdmNavigationProperty>();
        EdmNavigationProperty nextNavProperty =
            getNextNavigationProperty(context.getSourceEntitySet().getEntityType(), context.getNavigationProperty());
        if (nextNavProperty != null) {
          currentNavPropertyList.add(nextNavProperty);
        }
        HashMap<String, Object> navigationMap =
View Full Code Here

    WriteFeedCallbackResult result = new WriteFeedCallbackResult();
    HashMap<String, Object> inlinedEntry = (HashMap<String, Object>) context.getEntryData();
    List<Map<String, Object>> edmEntityList = new ArrayList<Map<String, Object>>();
    JPAEntityParser jpaResultParser = new JPAEntityParser();
    List<EdmNavigationProperty> currentNavPropertyList = null;
    EdmNavigationProperty currentNavigationProperty = context.getNavigationProperty();
    ExpandSelectTreeNode currentExpandTreeNode = context.getCurrentExpandSelectTreeNode();

    try {
      @SuppressWarnings({ "unchecked" })
      Collection<Object> listOfItems = (Collection<Object>) inlinedEntry.get(context.getNavigationProperty().getName());
      if (nextEntitySet == null) {
        nextEntitySet = context.getSourceEntitySet().getRelatedEntitySet(currentNavigationProperty);
      }
      if (currentExpandTreeNode.getProperties().size() > 0) {
        edmEntityList =
            jpaResultParser.parse2EdmEntityList(listOfItems, getEdmProperties(nextEntitySet,
                currentExpandTreeNode));
      } else {
        edmEntityList = jpaResultParser.parse2EdmEntityList(listOfItems, nextEntitySet.getEntityType());
      }
      result.setFeedData(edmEntityList);

      if (currentExpandTreeNode.getLinks().size() > 0) {
        currentNavPropertyList = new ArrayList<EdmNavigationProperty>();
        EdmNavigationProperty nextNavProperty =
            getNextNavigationProperty(context.getSourceEntitySet().getEntityType(), context.getNavigationProperty());
        if (nextNavProperty != null) {
          currentNavPropertyList.add(nextNavProperty);
        }
        int count = 0;
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.api.edm.EdmNavigationProperty

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.