Class TransactUtils


  • public class TransactUtils
    extends Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static String bytesToHexString​(byte[] bytes)
      This method builds a string by concatenating the 2 character hexadecimal representation of each byte from the input byte array.
      static <T extends org.opendaylight.yangtools.yang.binding.DataObject>
      Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T>
      extract​(Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?>,​org.opendaylight.yangtools.yang.binding.DataObject> changes, Class<T> klazz)  
      static <T extends org.opendaylight.yangtools.yang.binding.DataObject,​U extends org.opendaylight.yangtools.yang.binding.DataObject>
      Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T>
      extractCreated​(Collection<org.opendaylight.mdsal.binding.api.DataTreeModification<U>> changes, Class<T> clazz)
      Extract all the instances of clazz which were created in the given set of modifications.
      static <T extends org.opendaylight.yangtools.yang.binding.DataObject>
      Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T>
      extractCreated​(DataChangeEvent changes, Class<T> klazz)  
      static <T extends org.opendaylight.yangtools.yang.binding.DataObject,​U extends org.opendaylight.yangtools.yang.binding.DataObject>
      Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T>
      extractCreatedOrUpdated​(Collection<org.opendaylight.mdsal.binding.api.DataTreeModification<U>> changes, Class<T> clazz)
      Extract all the instances of clazz which were created or updated in the given set of modifications.
      static <T extends org.opendaylight.yangtools.yang.binding.DataObject,​U extends org.opendaylight.yangtools.yang.binding.DataObject>
      Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T>
      extractCreatedOrUpdated​(Collection<org.opendaylight.mdsal.binding.api.DataTreeModification<U>> changes, Class<T> clazz, Predicate<org.opendaylight.mdsal.binding.api.DataObjectModification<T>> filter)
      Extract all the instance of clazz which were created or updated in the given set of modifications, and which satisfy the given filter.
      static <T extends org.opendaylight.yangtools.yang.binding.DataObject>
      Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T>
      extractCreatedOrUpdated​(DataChangeEvent changes, Class<T> klazz)  
      static <T extends org.opendaylight.yangtools.yang.binding.DataObject,​U extends org.opendaylight.yangtools.yang.binding.DataObject>
      Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T>
      extractCreatedOrUpdatedOrRemoved​(Collection<org.opendaylight.mdsal.binding.api.DataTreeModification<U>> changes, Class<T> clazz)
      Extract all the instances of clazz which were created, updated, or removed in the given set of modifications.
      static <T extends org.opendaylight.yangtools.yang.binding.DataObject>
      Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T>
      extractCreatedOrUpdatedOrRemoved​(DataChangeEvent changes, Class<T> klazz)  
      static List<Insert> extractInsert​(TransactionBuilder transaction, GenericTableSchema schema)  
      static UUID extractNamedUuid​(Insert insert)
      Extract the NamedUuid from the Insert.
      static Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node>,​org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node> extractNode​(Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?>,​org.opendaylight.yangtools.yang.binding.DataObject> changes)  
      static <T extends org.opendaylight.yangtools.yang.binding.DataObject,​U extends org.opendaylight.yangtools.yang.binding.DataObject>
      Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T>
      extractOriginal​(Collection<org.opendaylight.mdsal.binding.api.DataTreeModification<U>> changes, Class<T> clazz)
      Extract the original instances of class clazz in the given set of modifications.
      static <T extends org.opendaylight.yangtools.yang.binding.DataObject>
      Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T>
      extractOriginal​(DataChangeEvent changes, Class<T> klazz)  
      static <T extends org.opendaylight.yangtools.yang.binding.DataObject,​U extends org.opendaylight.yangtools.yang.binding.DataObject>
      Set<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>>
      extractRemoved​(Collection<org.opendaylight.mdsal.binding.api.DataTreeModification<U>> changes, Class<T> clazz)
      Extract the instance identifier of removed instances of clazz from the given set of modifications.
      static <T extends org.opendaylight.yangtools.yang.binding.DataObject>
      Set<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>>
      extractRemoved​(DataChangeEvent changes, Class<T> klazz)  
      static <T extends org.opendaylight.yangtools.yang.binding.DataObject,​U extends org.opendaylight.yangtools.yang.binding.DataObject>
      Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T>
      extractRemovedObjects​(Collection<org.opendaylight.mdsal.binding.api.DataTreeModification<U>> changes, Class<T> clazz)
      Extract the removed instances of clazz from the given set of modifications.
      static <T extends org.opendaylight.yangtools.yang.binding.DataObject>
      Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T>
      extractRemovedObjects​(DataChangeEvent changes, Class<T> klazz)  
      static <T extends org.opendaylight.yangtools.yang.binding.DataObject,​U extends org.opendaylight.yangtools.yang.binding.DataObject>
      Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T>
      extractUpdated​(Collection<org.opendaylight.mdsal.binding.api.DataTreeModification<U>> changes, Class<T> clazz)
      Extract all the instances of clazz which were updated in the given set of modifications.
      static <T extends org.opendaylight.yangtools.yang.binding.DataObject>
      Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T>
      extractUpdated​(DataChangeEvent changes, Class<T> klazz)  
      static <T extends TableSchema<T>>
      void
      stampInstanceIdentifier​(TransactionBuilder transaction, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> iid, TableSchema<T> tableSchema, ColumnSchema<T,​Map<String,​String>> columnSchema, InstanceIdentifierCodec instanceIdentifierCodec)  
      static <T extends TableSchema<T>>
      Mutate<T>
      stampInstanceIdentifierMutation​(TransactionBuilder transaction, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?> iid, TableSchema<T> tableSchema, ColumnSchema<T,​Map<String,​String>> columnSchema, InstanceIdentifierCodec instanceIdentifierCodec)  
    • Method Detail

      • extractNode

        public static Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node>,​org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node> extractNode​(Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?>,​org.opendaylight.yangtools.yang.binding.DataObject> changes)
      • extractCreated

        public static <T extends org.opendaylight.yangtools.yang.binding.DataObject> Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T> extractCreated​(DataChangeEvent changes,
                                                                                                                                                                               Class<T> klazz)
      • extractCreated

        public static <T extends org.opendaylight.yangtools.yang.binding.DataObject,​U extends org.opendaylight.yangtools.yang.binding.DataObject> Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T> extractCreated​(Collection<org.opendaylight.mdsal.binding.api.DataTreeModification<U>> changes,
                                                                                                                                                                                                                                                  Class<T> clazz)
        Extract all the instances of clazz which were created in the given set of modifications.
        Type Parameters:
        T - The type of changes we're interested in.
        U - The type of changes to process.
        Parameters:
        changes - The changes to process.
        clazz - The class we're interested in.
        Returns:
        The created instances, mapped by instance identifier.
      • extractUpdated

        public static <T extends org.opendaylight.yangtools.yang.binding.DataObject> Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T> extractUpdated​(DataChangeEvent changes,
                                                                                                                                                                               Class<T> klazz)
      • extractUpdated

        public static <T extends org.opendaylight.yangtools.yang.binding.DataObject,​U extends org.opendaylight.yangtools.yang.binding.DataObject> Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T> extractUpdated​(Collection<org.opendaylight.mdsal.binding.api.DataTreeModification<U>> changes,
                                                                                                                                                                                                                                                  Class<T> clazz)
        Extract all the instances of clazz which were updated in the given set of modifications.
        Type Parameters:
        T - The type of changes we're interested in.
        U - The type of changes to process.
        Parameters:
        changes - The changes to process.
        clazz - The class we're interested in.
        Returns:
        The updated instances, mapped by instance identifier.
      • extractCreatedOrUpdated

        public static <T extends org.opendaylight.yangtools.yang.binding.DataObject,​U extends org.opendaylight.yangtools.yang.binding.DataObject> Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T> extractCreatedOrUpdated​(Collection<org.opendaylight.mdsal.binding.api.DataTreeModification<U>> changes,
                                                                                                                                                                                                                                                           Class<T> clazz,
                                                                                                                                                                                                                                                           Predicate<org.opendaylight.mdsal.binding.api.DataObjectModification<T>> filter)
        Extract all the instance of clazz which were created or updated in the given set of modifications, and which satisfy the given filter.
        Type Parameters:
        T - The type of changes we're interested in.
        U - The type of changes to process.
        Parameters:
        changes - The changes to process.
        clazz - The class we're interested in.
        filter - The filter the changes must satisfy.
        Returns:
        The created or updated instances which satisfy the filter, mapped by instance identifier.
      • extractCreatedOrUpdated

        public static <T extends org.opendaylight.yangtools.yang.binding.DataObject> Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T> extractCreatedOrUpdated​(DataChangeEvent changes,
                                                                                                                                                                                        Class<T> klazz)
      • extractCreatedOrUpdated

        public static <T extends org.opendaylight.yangtools.yang.binding.DataObject,​U extends org.opendaylight.yangtools.yang.binding.DataObject> Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T> extractCreatedOrUpdated​(Collection<org.opendaylight.mdsal.binding.api.DataTreeModification<U>> changes,
                                                                                                                                                                                                                                                           Class<T> clazz)
        Extract all the instances of clazz which were created or updated in the given set of modifications.
        Type Parameters:
        T - The type of changes we're interested in.
        U - The type of changes to process.
        Parameters:
        changes - The changes to process.
        clazz - The class we're interested in.
        Returns:
        The created or updated instances, mapped by instance identifier.
      • extractCreatedOrUpdatedOrRemoved

        public static <T extends org.opendaylight.yangtools.yang.binding.DataObject> Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T> extractCreatedOrUpdatedOrRemoved​(DataChangeEvent changes,
                                                                                                                                                                                                 Class<T> klazz)
      • extractCreatedOrUpdatedOrRemoved

        public static <T extends org.opendaylight.yangtools.yang.binding.DataObject,​U extends org.opendaylight.yangtools.yang.binding.DataObject> Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T> extractCreatedOrUpdatedOrRemoved​(Collection<org.opendaylight.mdsal.binding.api.DataTreeModification<U>> changes,
                                                                                                                                                                                                                                                                    Class<T> clazz)
        Extract all the instances of clazz which were created, updated, or removed in the given set of modifications. For instances which were created or updated, the new instances are returned; for instances which were removed, the old instances are returned.
        Type Parameters:
        T - The type of changes we're interested in.
        U - The type of changes to process.
        Parameters:
        changes - The changes to process.
        clazz - The class we're interested in.
        Returns:
        The created, updated or removed instances, mapped by instance identifier.
      • extractOriginal

        public static <T extends org.opendaylight.yangtools.yang.binding.DataObject> Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T> extractOriginal​(DataChangeEvent changes,
                                                                                                                                                                                Class<T> klazz)
      • extractOriginal

        public static <T extends org.opendaylight.yangtools.yang.binding.DataObject,​U extends org.opendaylight.yangtools.yang.binding.DataObject> Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T> extractOriginal​(Collection<org.opendaylight.mdsal.binding.api.DataTreeModification<U>> changes,
                                                                                                                                                                                                                                                   Class<T> clazz)
        Extract the original instances of class clazz in the given set of modifications.
        Type Parameters:
        T - The type of changes we're interested in.
        U - The type of changes to process.
        Parameters:
        changes - The changes to process.
        clazz - The class we're interested in.
        Returns:
        The original instances, mapped by instance identifier.
      • extractRemoved

        public static <T extends org.opendaylight.yangtools.yang.binding.DataObject> Set<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>> extractRemoved​(DataChangeEvent changes,
                                                                                                                                                                       Class<T> klazz)
      • extractRemoved

        public static <T extends org.opendaylight.yangtools.yang.binding.DataObject,​U extends org.opendaylight.yangtools.yang.binding.DataObject> Set<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>> extractRemoved​(Collection<org.opendaylight.mdsal.binding.api.DataTreeModification<U>> changes,
                                                                                                                                                                                                                                          Class<T> clazz)
        Extract the instance identifier of removed instances of clazz from the given set of modifications.
        Type Parameters:
        T - The type of changes we're interested in.
        U - The type of changes to process.
        Parameters:
        changes - The changes to process.
        clazz - The class we're interested in.
        Returns:
        The instance identifiers of removed instances.
      • extractRemovedObjects

        public static <T extends org.opendaylight.yangtools.yang.binding.DataObject> Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T> extractRemovedObjects​(DataChangeEvent changes,
                                                                                                                                                                                      Class<T> klazz)
      • extractRemovedObjects

        public static <T extends org.opendaylight.yangtools.yang.binding.DataObject,​U extends org.opendaylight.yangtools.yang.binding.DataObject> Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T> extractRemovedObjects​(Collection<org.opendaylight.mdsal.binding.api.DataTreeModification<U>> changes,
                                                                                                                                                                                                                                                         Class<T> clazz)
        Extract the removed instances of clazz from the given set of modifications.
        Type Parameters:
        T - The type of changes we're interested in.
        U - The type of changes to process.
        Parameters:
        changes - The changes to process.
        clazz - The class we're interested in.
        Returns:
        The removed instances, keyed by instance identifier.
      • extract

        public static <T extends org.opendaylight.yangtools.yang.binding.DataObject> Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>,​T> extract​(Map<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<?>,​org.opendaylight.yangtools.yang.binding.DataObject> changes,
                                                                                                                                                                        Class<T> klazz)
      • extractNamedUuid

        public static UUID extractNamedUuid​(Insert insert)
        Extract the NamedUuid from the Insert. If the Insert does not have a NamedUuid set, a random one will be generated, set, and returned.
        Parameters:
        insert - - Insert from which to extract the NamedUuid
        Returns:
        UUID - NamedUUID of the Insert
      • bytesToHexString

        public static String bytesToHexString​(byte[] bytes)
        This method builds a string by concatenating the 2 character hexadecimal representation of each byte from the input byte array.

        For example: an input byte array containing: bytes[0] = 'a' bytes[1] = 'b' bytes[2] = 'c' bytes[3] = '-' bytes[4] = '1' bytes[5] = '2' bytes[6] = '3' returns the string "6162632d313233"

        Parameters:
        bytes - The byte array to convert to string
        Returns:
        The hexadecimal representation of the byte array. If bytes is null, the string "" is returned