Java Code Examples for org.apache.olingo.commons.api.edm.EdmKeyPropertyRef#getName()

The following examples show how to use org.apache.olingo.commons.api.edm.EdmKeyPropertyRef#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataProvider.java    From olingo-odata4 with Apache License 2.0 6 votes vote down vote up
private Object findPropertyRefValue(Entity entity, EdmKeyPropertyRef refType) {
  final int INDEX_ERROR_CODE = -1;
  final String propertyPath = refType.getName();
  String tmpPropertyName;
  int lastIndex;
  int index = propertyPath.indexOf('/');
  if (index == INDEX_ERROR_CODE) {
      index  = propertyPath.length();
  }
  tmpPropertyName = propertyPath.substring(0, index);
  //get first property
  Property prop = entity.getProperty(tmpPropertyName);
  //get following properties
  while (index < propertyPath.length()) {
      lastIndex = ++index;
      index = propertyPath.indexOf('/', index+1);
      if (index == INDEX_ERROR_CODE) {
          index = propertyPath.length();
      }
      tmpPropertyName = propertyPath.substring(lastIndex, index);
      prop = findProperty(tmpPropertyName, prop.asComplex().getValue());
   }
  return prop.getValue();
}
 
Example 2
Source File: Storage.java    From syndesis with Apache License 2.0 5 votes vote down vote up
private static boolean isKey(EdmEntityType edmEntityType, String propertyName) {
    List<EdmKeyPropertyRef> keyPropertyRefs = edmEntityType.getKeyPropertyRefs();
    for (EdmKeyPropertyRef propRef : keyPropertyRefs) {
        String keyPropertyName = propRef.getName();
        if (keyPropertyName.equals(propertyName)) {
            return true;
        }
    }
    return false;
}
 
Example 3
Source File: UriHelperImpl.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
private Object findPropertyRefValue(Entity entity, EdmKeyPropertyRef refType) throws SerializerException {
  final int INDEX_ERROR_CODE = -1;
  final String propertyPath = refType.getName();
  String tmpPropertyName;
  int lastIndex;
  int index = propertyPath.indexOf('/');
  if (index == INDEX_ERROR_CODE) {
      index  = propertyPath.length();
  }
  tmpPropertyName = propertyPath.substring(0, index);
  //get first property
  Property prop = entity.getProperty(tmpPropertyName);
  //get following properties
  while (index < propertyPath.length()) {
      lastIndex = ++index;
      index = propertyPath.indexOf('/', index+1);
      if (index == INDEX_ERROR_CODE) {
          index = propertyPath.length();
      }
      tmpPropertyName = propertyPath.substring(lastIndex, index);
      prop = findProperty(tmpPropertyName, prop.asComplex().getValue());
   }
  if (prop == null) {
    throw new SerializerException("Key Value Cannot be null for property: " + propertyPath, 
        SerializerException.MessageKeys.NULL_PROPERTY, propertyPath);
  }
  return prop.getValue();
}
 
Example 4
Source File: Storage.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
private boolean isKey(EdmEntityType edmEntityType, String propertyName) {
  
  List<EdmKeyPropertyRef> keyPropertyRefs = edmEntityType.getKeyPropertyRefs();
  for (EdmKeyPropertyRef propRef : keyPropertyRefs) {
    String keyPropertyName = propRef.getName();
    if (keyPropertyName.equals(propertyName)) {
      return true;
    }
  }
  return false;
}
 
Example 5
Source File: Storage.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
private boolean isKey(EdmEntityType edmEntityType, String propertyName) {
  
  List<EdmKeyPropertyRef> keyPropertyRefs = edmEntityType.getKeyPropertyRefs();
  for (EdmKeyPropertyRef propRef : keyPropertyRefs) {
    String keyPropertyName = propRef.getName();
    if (keyPropertyName.equals(propertyName)) {
      return true;
    }
  }
  return false;
}
 
Example 6
Source File: Storage.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
private boolean isKey(EdmEntityType edmEntityType, String propertyName) {
  List<EdmKeyPropertyRef> keyPropertyRefs = edmEntityType.getKeyPropertyRefs();
  for (EdmKeyPropertyRef propRef : keyPropertyRefs) {
    String keyPropertyName = propRef.getName();
    if (keyPropertyName.equals(propertyName)) {
      return true;
    }
  }
  return false;
}
 
Example 7
Source File: Storage.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
private boolean isKey(EdmEntityType edmEntityType, String propertyName) {
  
  List<EdmKeyPropertyRef> keyPropertyRefs = edmEntityType.getKeyPropertyRefs();
  for (EdmKeyPropertyRef propRef : keyPropertyRefs) {
    String keyPropertyName = propRef.getName();
    if (keyPropertyName.equals(propertyName)) {
      return true;
    }
  }
  return false;
}
 
Example 8
Source File: Storage.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
private boolean isKey(EdmEntityType edmEntityType, String propertyName) {
  
  List<EdmKeyPropertyRef> keyPropertyRefs = edmEntityType.getKeyPropertyRefs();
  for (EdmKeyPropertyRef propRef : keyPropertyRefs) {
    String keyPropertyName = propRef.getName();
    if (keyPropertyName.equals(propertyName)) {
      return true;
    }
  }
  return false;
}
 
Example 9
Source File: Storage.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
private boolean isKey(EdmEntityType edmEntityType, String propertyName) {
  List<EdmKeyPropertyRef> keyPropertyRefs = edmEntityType.getKeyPropertyRefs();
  for (EdmKeyPropertyRef propRef : keyPropertyRefs) {
    String keyPropertyName = propRef.getName();
    if (keyPropertyName.equals(propertyName)) {
      return true;
    }
  }
  return false;
}
 
Example 10
Source File: Storage.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
private boolean isKey(EdmEntityType edmEntityType, String propertyName) {
  
  List<EdmKeyPropertyRef> keyPropertyRefs = edmEntityType.getKeyPropertyRefs();
  for (EdmKeyPropertyRef propRef : keyPropertyRefs) {
    String keyPropertyName = propRef.getName();
    if (keyPropertyName.equals(propertyName)) {
      return true;
    }
  }
  return false;
}
 
Example 11
Source File: Storage.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
private boolean isKey(EdmEntityType edmEntityType, String propertyName) {
  List<EdmKeyPropertyRef> keyPropertyRefs = edmEntityType.getKeyPropertyRefs();
  for (EdmKeyPropertyRef propRef : keyPropertyRefs) {
    String keyPropertyName = propRef.getName();
    if (keyPropertyName.equals(propertyName)) {
      return true;
    }
  }
  return false;
}