Class SchemaUtils
java.lang.Object
de.hybris.platform.odata2services.odata.schema.utils.SchemaUtils
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildAssociationName(String sourceTypeCode, String targetTypeCode) static List<org.apache.olingo.odata2.api.edm.provider.AnnotationAttribute>Defines new annotation attributes for things like namespacesstatic Optional<TypeAttributeDescriptor>findFirstLocalizedAttribute(Collection<IntegrationObjectItemAttributeModel> attributeModels) Deprecated, for removal: This API element is subject to removal in a future version.static StringfullyQualified(String name) Prepends schema name to the specified name.static StringlocalizedEntityName(String typeCode) Returns the localized entity namestatic <T,U> List<T> removeDuplicates(List<T> list, Function<T, U> idFunction) Removes duplicates from the givenListAn example usage would be: Given aListTo remove replicates, calllist = Arrays.asList("a", "b", "a"); removeDuplicates(list, e -> e);, where the idFunction is the element e itself.static org.apache.olingo.odata2.api.edm.FullQualifiedNametoFullQualifiedName(String name) Converts specified simple schema element name to the fully qualified name.
-
Field Details
-
NAMESPACE
- See Also:
-
CONTAINER_NAME
- See Also:
-
-
Method Details
-
fullyQualified
Prepends schema name to the specified name.- Parameters:
name- name of a schema element, e.g. EnityType, to be presented in a fully qualified format.- Returns:
- string presentation of the fully qualified name.
- Throws:
IllegalArgumentException- if the specified name isnull, empty or blank.
-
toFullQualifiedName
Converts specified simple schema element name to the fully qualified name.- Parameters:
name- name of a schema element, e.g. EntityType, to be converted.- Returns:
- fully qualified name.
- Throws:
IllegalArgumentException- if the specified name isnull, empty or blank.
-
buildAssociationName
-
localizedEntityName
Returns the localized entity name- Parameters:
typeCode- type of the integration object item- Returns:
- localized entity name
-
removeDuplicates
Removes duplicates from the givenListAn example usage would be: Given aListTo remove replicates, calllist = Arrays.asList("a", "b", "a"); removeDuplicates(list, e -> e);, where the idFunction is the element e itself. The resulting list would be["a", "b"].- Type Parameters:
T- Type of the elements in theListU- Type of the unique identifier of object T- Parameters:
list- List to remove the duplicates fromidFunction- Function that returns the identifier that uniquely identifies object of type T- Returns:
- List of type T with duplicates removed
-
findFirstLocalizedAttribute
@Deprecated(since="2205", forRemoval=true) public static Optional<TypeAttributeDescriptor> findFirstLocalizedAttribute(Collection<IntegrationObjectItemAttributeModel> attributeModels) Deprecated, for removal: This API element is subject to removal in a future version.switch to useTypeAttributeDescriptorinstead of theIntegrationObjectItemAttributeModelselecting localized attributes is trivial with TypeAttributeDescriptor through the usage of theTypeAttributeDescriptor.isLocalized()method.Finds the first localized attribute from theCollectionof attributes- Parameters:
attributeModels- Collection of attributes- Returns:
- An
Optionalcontaining theTypeAttributeDescriptorif found, otherwise empty
-
createNamespaceAnnotations
public static List<org.apache.olingo.odata2.api.edm.provider.AnnotationAttribute> createNamespaceAnnotations()Defines new annotation attributes for things like namespaces- Returns:
- the newly defined annotation attributes
-
TypeAttributeDescriptorinstead of theIntegrationObjectItemAttributeModelselecting localized attributes is trivial with TypeAttributeDescriptor through the usage of theTypeAttributeDescriptor.isLocalized()method.