Package org.apache.olingo.odata2.api.ep

Examples of org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties


  }

  @Test
  public void serializeAtomEntry() throws IOException, XpathException, SAXException, XMLStreamException,
      FactoryConfigurationError, ODataException {
    final EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(BASE_URI).build();
    AtomEntityProvider ser = createAtomEntityProvider();
    ODataResponse response =
        ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"), roomData, properties);
    String xmlString = verifyResponse(response);
View Full Code Here


    assertXpathExists("/a:entry/a:content/m:properties", xmlString);
  }

  @Test
  public void serializeAtomEntryWithSimplePropertyTypeInformation() throws Exception {
    final EntityProviderWriteProperties properties =
        EntityProviderWriteProperties.serviceRoot(BASE_URI).includeSimplePropertyType(true).build();
    AtomEntityProvider ser = createAtomEntityProvider();
    ODataResponse response =
        ser.writeEntry(MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms"), roomData, properties);
    String xmlString = verifyResponse(response);
View Full Code Here

    team2Data.put("isScrumTeam", false);
    List<Map<String, Object>> teamsData = new ArrayList<Map<String, Object>>();
    teamsData.add(team1Data);
    teamsData.add(team2Data);

    EntityProviderWriteProperties properties =
        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).omitJsonWrapper(true).build();
    final ODataResponse response = new JsonEntityProvider().writeFeed(entitySet, teamsData, properties);
    assertNotNull(response);
    assertNotNull(response.getEntity());
    assertNull("EntitypProvider must not set content header", response.getContentHeader());
View Full Code Here

        case URI7A:
            // $links with 0..1 cardinality property
            final EdmEntitySet targetLinkEntitySet = uriInfo.getTargetEntitySet();
            final URI rootLinkUri = new URI(targetLinkEntitySet.getName());
            EntityProviderWriteProperties linkProperties =
                EntityProviderWriteProperties.serviceRoot(rootLinkUri).build();
            @SuppressWarnings("unchecked")
            final Map<String, Object> linkMap = (Map<String, Object>) content;
            response = EntityProvider.writeLink(responseContentType, targetLinkEntitySet, linkMap, linkProperties);
            break;

        case URI7B:
            // $links with * cardinality property
            final EdmEntitySet targetLinksEntitySet = uriInfo.getTargetEntitySet();
            final URI rootLinksUri = new URI(targetLinksEntitySet.getName());
            EntityProviderWriteProperties linksProperties =
                EntityProviderWriteProperties.serviceRoot(rootLinksUri).build();
            @SuppressWarnings("unchecked")
            final Map<String, Object> linksMap = (Map<String, Object>) content;
            response = EntityProvider.writeLink(responseContentType, targetLinksEntitySet, linksMap, linksProperties);
            break;

        case URI1:
        case URI2:
        case URI6A:
        case URI6B:
            // Entity
            final EdmEntitySet targetEntitySet = uriInfo.getTargetEntitySet();
            final URI rootUri = new URI(targetEntitySet.getName());
            EntityProviderWriteProperties properties = EntityProviderWriteProperties.serviceRoot(rootUri).build();
            @SuppressWarnings("unchecked")
            final Map<String, Object> objectMap = (Map<String, Object>) content;
            response = EntityProvider.writeEntry(responseContentType, targetEntitySet, objectMap, properties);
            break;

View Full Code Here

    List<String> selectedProperties = new ArrayList<String>(roomData.keySet());

    ExpandSelectTreeNode expandSelectTree =
        ExpandSelectTreeNode.entitySet(roomsSet).selectedProperties(selectedProperties).build();

    EntityProviderWriteProperties properties =
        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).expandSelectTree(expandSelectTree).build();
    ODataResponse entry = EntityProvider.writeEntry("application/xml", roomsSet, roomData, properties);

    String xml = StringHelper.inputStreamToString((InputStream) entry.getEntity());
    assertXpathExists("/a:entry/a:content/m:properties", xml);
View Full Code Here

    selectedNavigationProperties.add("nr_Employees");

    ExpandSelectTreeNode expandSelectTree =
        ExpandSelectTreeNode.entitySet(roomsSet).selectedLinks(selectedNavigationProperties).build();

    EntityProviderWriteProperties properties =
        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).expandSelectTree(expandSelectTree).build();
    ODataResponse entry = EntityProvider.writeEntry("application/xml", roomsSet, roomData, properties);

    String xml = StringHelper.inputStreamToString((InputStream) entry.getEntity());
    assertXpathNotExists("/a:entry/a:content/m:properties", xml);
View Full Code Here

    ExpandSelectTreeNode expandSelectTree =
        ExpandSelectTreeNode.entitySet(roomsSet).selectedProperties(selectedProperties).selectedLinks(
            selectedNavigationProperties).build();

    EntityProviderWriteProperties properties =
        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).expandSelectTree(expandSelectTree).build();
    ODataResponse entry = EntityProvider.writeEntry("application/xml", roomsSet, roomData, properties);

    String xml = StringHelper.inputStreamToString((InputStream) entry.getEntity());
    assertXpathExists("/a:entry/a:content/m:properties", xml);
View Full Code Here

    ExpandSelectTreeNode expandSelectTree =
        ExpandSelectTreeNode.entitySet(roomsSet).expandedLinks(expandedNavigationProperties).build();

    Map<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
    callbacks.put("nr_Building", new LocalCallback());
    EntityProviderWriteProperties properties =
        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).callbacks(callbacks).expandSelectTree(
            expandSelectTree).build();
    ODataResponse entry = EntityProvider.writeEntry("application/xml", roomsSet, roomData, properties);

    String xml = StringHelper.inputStreamToString((InputStream) entry.getEntity());
View Full Code Here

        ExpandSelectTreeNode.entitySet(roomsSet).selectedProperties(selectedProperties).expandedLinks(
            expandedNavigationProperties).build();

    Map<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
    callbacks.put("nr_Building", new LocalCallback());
    EntityProviderWriteProperties properties =
        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).callbacks(callbacks).expandSelectTree(
            expandSelectTree).build();
    ODataResponse entry = EntityProvider.writeEntry("application/xml", roomsSet, roomData, properties);

    String xml = StringHelper.inputStreamToString((InputStream) entry.getEntity());
View Full Code Here

    ExpandSelectTreeNode expandSelectTree =
        ExpandSelectTreeNode.entitySet(roomsSet).customExpandedLink("nr_Building", customNode).build();

    Map<String, ODataCallback> callbacks = new HashMap<String, ODataCallback>();
    callbacks.put("nr_Building", new LocalCallback());
    EntityProviderWriteProperties properties =
        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).callbacks(callbacks).expandSelectTree(
            expandSelectTree).build();
    ODataResponse entry = EntityProvider.writeEntry("application/xml", roomsSet, roomData, properties);

    String xml = StringHelper.inputStreamToString((InputStream) entry.getEntity());
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.api.ep.EntityProviderWriteProperties

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.