Examples of EdmEntityType


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

    String mediaResourceSourceKey = "~src";
    localRoomData.put(mediaResourceSourceKey, "http://localhost:8080/images/image1");
    String mediaResourceMimeTypeKey = "~type";
    localRoomData.put(mediaResourceMimeTypeKey, "image/jpeg");
    EdmEntitySet roomsSet = MockFacade.getMockEdm().getDefaultEntityContainer().getEntitySet("Rooms");
    EdmEntityType roomType = roomsSet.getEntityType();
    EdmMapping mapping = mock(EdmMapping.class);
    when(roomType.getMapping()).thenReturn(mapping);
    when(mapping.getMediaResourceSourceKey()).thenReturn(mediaResourceSourceKey);
    when(mapping.getMediaResourceMimeTypeKey()).thenReturn(mediaResourceMimeTypeKey);

    ODataResponse response = ser.writeEntry(roomsSet, localRoomData, DEFAULT_PROPERTIES);
    String xmlString = verifyResponse(response);
View Full Code Here

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

      while (data.size() > SERVER_PAGING_SIZE) {
        data.remove(SERVER_PAGING_SIZE);
      }
    }

    final EdmEntityType entityType = entitySet.getEntityType();
    List<Map<String, Object>> values = new ArrayList<Map<String, Object>>();
    for (final Object entryData : data) {
      values.add(getStructuralTypeValueMap(entryData, entityType));
    }
View Full Code Here

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

  @Override
  public ODataResponse createEntity(final PostUriInfo uriInfo, final InputStream content,
      final String requestContentType, final String contentType) throws ODataException {
    final EdmEntitySet entitySet = uriInfo.getTargetEntitySet();
    final EdmEntityType entityType = entitySet.getEntityType();

    Object data = dataSource.newDataObject(entitySet);
    ExpandSelectTreeNode expandSelectTree = null;

    if (entityType.hasStream()) {
      dataSource.createData(entitySet, data);
      dataSource.writeBinaryData(entitySet, data,
          new BinaryData(EntityProvider.readBinary(content), requestContentType));

    } else {
View Full Code Here

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

    if (!appliesFilter(data, uriInfo.getFilter())) {
      throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
    }

    final EdmEntitySet entitySet = uriInfo.getTargetEntitySet();
    final EdmEntityType entityType = entitySet.getEntityType();
    final EntityProviderReadProperties properties = EntityProviderReadProperties.init()
        .mergeSemantic(merge)
        .addTypeMappings(getStructuralTypeTypeMap(data, entityType))
        .build();
    final ODataEntry entryValues = parseEntry(entitySet, content, requestContentType, properties);
View Full Code Here

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

    }
    return data;
  }

  private <T> String constructETag(final EdmEntitySet entitySet, final T data) throws ODataException {
    final EdmEntityType entityType = entitySet.getEntityType();
    String eTag = null;
    for (final String propertyName : entityType.getPropertyNames()) {
      final EdmProperty property = (EdmProperty) entityType.getProperty(propertyName);
      if (property.getFacets() != null && property.getFacets().getConcurrencyMode() == EdmConcurrencyMode.Fixed) {
        final EdmSimpleType type = (EdmSimpleType) property.getType();
        final String component = type.valueToString(valueAccess.getPropertyValue(data, property),
            EdmLiteralKind.DEFAULT, property.getFacets());
        eTag = eTag == null ? component : eTag + Edm.DELIMITER + component;
View Full Code Here

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

    }
  }

  private <T> ODataResponse writeEntry(final EdmEntitySet entitySet, final ExpandSelectTreeNode expandSelectTree,
      final T data, final String contentType) throws ODataException, EntityProviderException {
    final EdmEntityType entityType = entitySet.getEntityType();
    final Map<String, Object> values = getStructuralTypeValueMap(data, entityType);

    ODataContext context = getContext();
    EntityProviderWriteProperties writeProperties = EntityProviderWriteProperties
        .serviceRoot(context.getPathInfo().getServiceRoot())
View Full Code Here

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

    return key == null ? null : mapKey(key);
  }

  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);
      if (relatedValue == null) {
        for (final String uriString : entryValues.getMetadata().getAssociationUris(navigationPropertyName)) {
          final Map<String, Object> key = parseLinkUri(relatedEntitySet, uriString);
View Full Code Here

Examples of org.odata4j.edm.EdmEntityType

  private OEntity toOEntity(EdmEntitySet ees, Entity entity, QueryInfo queryInfo, String parentPropName) {
    final List<OProperty<?>> properties = new ArrayList<OProperty<?>>();
    final List<OLink> links = new ArrayList<OLink>();

    EdmEntityType eet = ees.getType();
    String entityKeyName = eet.getKeys().get(0);
    OEntityKey entityKey = OEntityKey.create(OProperties.int64(entityKeyName, entity.getKey().getId()));
    if (queryInfo == null || queryInfo.select == null || queryInfo.select.size() == 0 || containsProperty(queryInfo.select, entityKeyName, parentPropName)) {
      properties.add(OProperties.int64(entityKeyName, entity.getKey().getId()));
    }

    for (String propName : entity.getProperties().keySet()) {
      Object propValue = entity.getProperty(propName);
      if (propValue == null)
        continue;

      if (queryInfo != null && queryInfo.select != null && queryInfo.select.size() > 0) {
        if (!containsProperty(queryInfo.select, propName, parentPropName)) {
          continue;
        }
      }

      EdmProperty prop = eet.findProperty(propName);
      if (prop != null) {
        if (propValue instanceof Text) {
          propValue = ((Text) propValue).getValue();
        } else if (propValue instanceof ShortBlob) {
          propValue = ((ShortBlob) propValue).getBytes();
        }
        properties.add(OProperties.simple(propName, (EdmSimpleType<?>) prop.getType(), propValue));
      } else {
        EdmNavigationProperty navProp = eet.findNavigationProperty(propName);
        if (navProp != null) {
          List<OEntity> expandedProps = new ArrayList<OEntity>();
          try {
            if (queryInfo != null && queryInfo.expand != null && queryInfo.expand.size() > 0) {
              for (EntitySimpleProperty esp : queryInfo.expand) {
View Full Code Here

Examples of org.odata4j.edm.EdmEntityType

      try {
        String uri = link.getHref();
        String entitySetName = e.getKind();
        String key = uri.substring(uri.lastIndexOf('('));
        EdmEntitySet ees = metadata.getEdmEntitySet(entitySetName);
        EdmEntityType eet = ees.getType();
        EdmNavigationProperty enp = eet.findNavigationProperty(link.getRelation());
        EdmMultiplicity em = enp.getRelationship().getEnd2().getMultiplicity();
        Entity entity = findEntity(enp.getToRole().getType().getName(), OEntityKey.parse(key));
        if (em == EdmMultiplicity.ZERO_TO_ONE) {
          e.setProperty(link.getRelation(), entity.getKey());
        } else {
View Full Code Here

Examples of org.odata4j.edm.EdmEntityType

    // Support for filtering navigation properties by key
    if (propName.contains("/")) {
      propName = propName.substring(0, propName.indexOf("/"));
      EdmEntitySet ees = metadata.getEdmEntitySet(q.getKind());
      EdmEntityType eet = ees.getType();
      EdmNavigationProperty enp = eet.findNavigationProperty(propName);
      long id = Long.parseLong(propValue.toString());
      propValue = KeyFactory.createKey(enp.getToRole().getRole(), id);
    }

    Filter filter = new FilterPredicate(propName, op, propValue);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.