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

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


    expandedLinks.add("ne_Room");

    ExpandSelectTreeNode expandSelectTreeNode =
        ExpandSelectTreeNode.entitySet(entitySet).selectedProperties(selectedProperties).expandedLinks(expandedLinks)
            .build();
    EntityProviderWriteProperties properties =
        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).omitJsonWrapper(true).contentOnly(true)
            .expandSelectTree(expandSelectTreeNode).build();
    final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, employeeData, properties);
    Map<String, Object> employee =
        (Map<String, Object>) new Gson().fromJson(new InputStreamReader((InputStream) response.getEntity()), Map.class);
View Full Code Here


    Map<String, Map<String, Object>> additinalLinks = new HashMap<String, Map<String, Object>>();
    Map<String, Object> managerLink = new HashMap<String, Object>();
    managerLink.put("EmployeeId", "1");
    additinalLinks.put("ne_Manager", managerLink);

    EntityProviderWriteProperties properties =
        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).omitJsonWrapper(true).contentOnly(true)
            .expandSelectTree(expandSelectTreeNode).additionalLinks(additinalLinks).build();
    final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, employeeData, properties);
    // System.out.println(StringHelper.inputStreamToString((InputStream) response.getEntity()));
    Map<String, Object> employee =
View Full Code Here

    final EdmEntitySet entitySet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Teams");
    Map<String, Object> teamData = new HashMap<String, Object>();
    teamData.put("Id", "1");
    teamData.put("isScrumTeam", true);

    EntityProviderWriteProperties properties =
        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).omitJsonWrapper(true).build();
    final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, teamData, properties);
    final String json = verifyResponse(response);
    assertEquals("{\"__metadata\":{\"id\":\"" + BASE_URI + "Teams('1')\","
        + "\"uri\":\"" + BASE_URI + "Teams('1')\",\"type\":\"RefScenario.Team\"},"
View Full Code Here

    final EdmProperty property = (EdmProperty) entitySet.getEntityType().getProperty("EntryDate");
    ExpandSelectTreeNode node = Mockito.mock(ExpandSelectTreeNode.class);
    Mockito.when(node.getProperties()).thenReturn(Arrays.asList(property));

    EntityProviderWriteProperties writeProperties =
        EntityProviderWriteProperties.fromProperties(DEFAULT_PROPERTIES).serviceRoot(URI.create(BASE_URI))
            .expandSelectTree(node).build();

    final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, employeeData,
        writeProperties);
View Full Code Here

    data.put("Id", "1");
    Map<String, Object> key = new HashMap<String, Object>();
    key.put("Id", "3");
    Map<String, Map<String, Object>> links = new HashMap<String, Map<String, Object>>();
    links.put("nr_Building", key);
    final EntityProviderWriteProperties properties = EntityProviderWriteProperties
        .serviceRoot(URI.create(BASE_URI))
        .additionalLinks(links)
        .build();

    final ODataResponse response = new JsonEntityProvider().writeEntry(entitySet, data, properties);
View Full Code Here

        } catch (final ODataNotFoundException e) {
          values.clear();
        }
        WriteFeedCallbackResult result = new WriteFeedCallbackResult();
        result.setFeedData(values);
        EntityProviderWriteProperties inlineProperties =
            EntityProviderWriteProperties.serviceRoot(getContext().getPathInfo().getServiceRoot()).callbacks(
                getCallbacks(relatedData, entityType)).expandSelectTree(context.getCurrentExpandSelectTreeNode())
                .selfLink(context.getSelfLink()).build();
        result.setInlineProperties(inlineProperties);
        return result;
View Full Code Here

        if (relatedData == null) {
          result.setEntryData(Collections.<String, Object> emptyMap());
        } else {
          result.setEntryData(getStructuralTypeValueMap(relatedData, entityType));

          EntityProviderWriteProperties inlineProperties =
              EntityProviderWriteProperties.serviceRoot(getContext().getPathInfo().getServiceRoot()).callbacks(
                  getCallbacks(relatedData, entityType)).expandSelectTree(context.getCurrentExpandSelectTreeNode())
                  .build();
          result.setInlineProperties(inlineProperties);
        }
View Full Code Here

        } catch (final ODataNotFoundException e) {
          values.clear();
        }
        WriteFeedCallbackResult result = new WriteFeedCallbackResult();
        result.setFeedData(values);
        EntityProviderWriteProperties inlineProperties =
            EntityProviderWriteProperties.serviceRoot(getContext().getPathInfo().getServiceRoot()).callbacks(
                getCallbacks(relatedData, entityType)).expandSelectTree(context.getCurrentExpandSelectTreeNode())
                .selfLink(context.getSelfLink()).build();
        result.setInlineProperties(inlineProperties);
        return result;
View Full Code Here

        if (relatedData == null) {
          result.setEntryData(Collections.<String, Object> emptyMap());
        } else {
          result.setEntryData(getStructuralTypeValueMap(relatedData, entityType));

          EntityProviderWriteProperties inlineProperties =
              EntityProviderWriteProperties.serviceRoot(getContext().getPathInfo().getServiceRoot()).callbacks(
                  getCallbacks(relatedData, entityType)).expandSelectTree(context.getCurrentExpandSelectTreeNode())
                  .build();
          result.setInlineProperties(inlineProperties);
        }
View Full Code Here

    List<Map<String, Object>> values = new ArrayList<Map<String, Object>>();
    for (final Object entryData : data) {
      values.add(getStructuralTypeValueMap(entryData, entityType));
    }

    final EntityProviderWriteProperties feedProperties = EntityProviderWriteProperties
        .serviceRoot(context.getPathInfo().getServiceRoot())
        .inlineCountType(inlineCountType)
        .inlineCount(count)
        .expandSelectTree(UriParser.createExpandSelectTree(uriInfo.getSelect(), uriInfo.getExpand()))
        .callbacks(getCallbacks(data, entityType))
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.