Class PropagationByResource<T extends Serializable>

  • Type Parameters:
    T - key for propagation: could be simple resource or pair (resource, connObjectKeyValue) for linked accounts
    All Implemented Interfaces:
    Serializable

    public class PropagationByResource<T extends Serializable>
    extends Object
    implements Serializable
    Encapsulates operations to be performed on various resources.
    See Also:
    Serialized Form
    • Constructor Detail

      • PropagationByResource

        public PropagationByResource()
        Default constructor.
    • Method Detail

      • purge

        public final void purge()
        Avoid potential conflicts by not doing create or update on any resource for which a delete is requested, and by not doing any create on any resource for which an update is requested.
      • add

        public final boolean add​(ResourceOperation type,
                                 T key)
        Add an element.
        Parameters:
        type - resource operation type
        key - target resource
        Returns:
        whether the operation was successful or not
      • addAll

        public boolean addAll​(ResourceOperation type,
                              Collection<T> keys)
        Add some elements.
        Parameters:
        type - resource operation type
        keys - target resources
        Returns:
        whether the operation was successful or not
      • remove

        public final boolean remove​(ResourceOperation type,
                                    T key)
        Remove an element.
        Parameters:
        type - resource operation type
        key - target resource
        Returns:
        whether the operation was successful or not
      • removeAll

        public boolean removeAll​(ResourceOperation type,
                                 Set<T> keys)
        Remove some elements.
        Parameters:
        type - resource operation type
        keys - target resources
        Returns:
        whether the operation was successful or not
      • removeAll

        public boolean removeAll​(Collection<T> keys)
        Removes only the resource names in the underlying resource name sets that are contained in the specified collection.
        Parameters:
        keys - collection containing resource names to be retained in the underlying resource name sets
        Returns:
        true if the underlying resource name sets changed as a result of the call
        See Also:
        Collection.removeAll(java.util.Collection)
      • retainAll

        public boolean retainAll​(Collection<T> keys)
        Retains only the resource names in the underlying resource name sets that are contained in the specified collection.
        Parameters:
        keys - collection containing resource names to be retained in the underlying resource name sets
        Returns:
        true if the underlying resource name sets changed as a result of the call
        See Also:
        Collection.retainAll(java.util.Collection)
      • contains

        public boolean contains​(T key)
      • get

        public final Set<T> get​(ResourceOperation type)
        Get resources for a given resource operation type.
        Parameters:
        type - resource operation type
        Returns:
        resource matching the given type
      • set

        public final void set​(ResourceOperation type,
                              Collection<T> keys)
        Set resources for a given resource operation type.
        Parameters:
        type - resource operation type
        keys - to be set
      • merge

        public final void merge​(PropagationByResource<T> propByRes)
        Merge another resource operation instance into this instance.
        Parameters:
        propByRes - to be merged
      • clear

        public void clear()
        Removes all of the operations.
      • isEmpty

        public final boolean isEmpty()
        Whether no operations are present.
        Returns:
        true if no operations (create / update / delete) and no old connObjectKeys are present
      • getOldConnObjectKeys

        public Map<String,​String> getOldConnObjectKeys()
        Fetch all old connObjectKeys.
        Returns:
        old connObjectKeys; can be empty
      • getOldConnObjectKey

        public String getOldConnObjectKey​(String resourceKey)
        Fetch old connObjectKey for given resource name.
        Parameters:
        resourceKey - resource name
        Returns:
        old connObjectKey; can be null
      • addOldConnObjectKey

        public void addOldConnObjectKey​(String resourceKey,
                                        String oldConnObjectKey)
        Add old ConnObjectKey for a given resource name.
        Parameters:
        resourceKey - resourceKey resource name
        oldConnObjectKey - old ConnObjectKey