Class SchemaUtils


  • public final class SchemaUtils
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CONTAINER_NAME  
      static java.lang.String NAMESPACE  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String buildAssociationName​(java.lang.String sourceTypeCode, java.lang.String targetTypeCode)  
      static java.util.List<org.apache.olingo.odata2.api.edm.provider.AnnotationAttribute> createNamespaceAnnotations()
      Defines new annotation attributes for things like namespaces
      static java.util.Optional<TypeAttributeDescriptor> findFirstLocalizedAttribute​(java.util.Collection<IntegrationObjectItemAttributeModel> attributeModels)
      Finds the first localized attribute from the Collection of attributes
      static java.lang.String fullyQualified​(java.lang.String name)
      Prepends schema name to the specified name.
      static java.lang.String localizedEntityName​(java.lang.String typeCode)
      Returns the localized entity name
      static <T,​U>
      java.util.List<T>
      removeDuplicates​(java.util.List<T> list, java.util.function.Function<T,​U> idFunction)
      Removes duplicates from the given List An example usage would be: Given a List list = Arrays.asList("a", "b", "a"); To remove replicates, call removeDuplicates(list, e -> e);, where the idFunction is the element e itself.
      static org.apache.olingo.odata2.api.edm.FullQualifiedName toFullQualifiedName​(java.lang.String name)
      Converts specified simple schema element name to the fully qualified name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • fullyQualified

        public static java.lang.String fullyQualified​(java.lang.String name)
        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:
        java.lang.IllegalArgumentException - if the specified name is null, empty or blank.
      • toFullQualifiedName

        public static org.apache.olingo.odata2.api.edm.FullQualifiedName toFullQualifiedName​(java.lang.String name)
        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:
        java.lang.IllegalArgumentException - if the specified name is null, empty or blank.
      • buildAssociationName

        public static java.lang.String buildAssociationName​(java.lang.String sourceTypeCode,
                                                            java.lang.String targetTypeCode)
      • localizedEntityName

        public static java.lang.String localizedEntityName​(java.lang.String typeCode)
        Returns the localized entity name
        Parameters:
        typeCode - type of the integration object item
        Returns:
        localized entity name
      • removeDuplicates

        public static <T,​U> java.util.List<T> removeDuplicates​(java.util.List<T> list,
                                                                     java.util.function.Function<T,​U> idFunction)
        Removes duplicates from the given List An example usage would be: Given a List list = Arrays.asList("a", "b", "a"); To remove replicates, call 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 the List
        U - Type of the unique identifier of object T
        Parameters:
        list - List to remove the duplicates from
        idFunction - Function that returns the identifier that uniquely identifies object of type T
        Returns:
        List of type T with duplicates removed
      • findFirstLocalizedAttribute

        public static java.util.Optional<TypeAttributeDescriptor> findFirstLocalizedAttribute​(java.util.Collection<IntegrationObjectItemAttributeModel> attributeModels)
        Finds the first localized attribute from the Collection of attributes
        Parameters:
        attributeModels - Collection of attributes
        Returns:
        An Optional containing the TypeAttributeDescriptor if found, otherwise empty
      • createNamespaceAnnotations

        public static java.util.List<org.apache.olingo.odata2.api.edm.provider.AnnotationAttribute> createNamespaceAnnotations()
        Defines new annotation attributes for things like namespaces
        Returns:
        the newly defined annotation attributes