Package org.spdx.core

Interface IModelCopyManager


  • public interface IModelCopyManager
    Implementation classes of this interface helps facilitate copying objects from one model to another.

    In addition to the copy functions (methods), these objects keeps track of what was copied where so that the same object is not copied twice.

    These objects can be passed into the constructor for ModelObjects to allow the objects to be copied.

    Author:
    Gary O'Neall
    • Method Detail

      • copy

        TypedValue copy​(IModelStore toStore,
                        IModelStore fromStore,
                        String sourceUri,
                        String toSpecVersion,
                        @Nullable
                        String toNamespace)
                 throws InvalidSPDXAnalysisException
        Copy an item from one Model Object Store to another using the source ID for the target unless it is anonymous
        Parameters:
        toStore - Model Store to copy to
        fromStore - Model Store containing the source item
        sourceUri - URI for the Source object
        toSpecVersion - version of the spec the to value should comply with
        toNamespace - optional namespace of the to property
        Returns:
        Object URI for the copied object
        Throws:
        InvalidSPDXAnalysisException - on any SPDX related error
      • copy

        void copy​(IModelStore toStore,
                  String toObjectUri,
                  IModelStore fromStore,
                  String fromObjectUri,
                  String toSpecVersion,
                  @Nullable
                  String toNamespace)
           throws InvalidSPDXAnalysisException
        Copy an item from one Model Object Store to another
        Parameters:
        toStore - Model Store to copy to
        toObjectUri - URI for the destination object
        fromStore - Model Store containing the source item
        fromObjectUri - Object URI for the source item
        toSpecVersion - version of the spec the to value should comply with
        toNamespace - optional namespace of the to property
        Throws:
        InvalidSPDXAnalysisException - on any SPDX related error
      • getCopiedObjectUri

        String getCopiedObjectUri​(IModelStore fromStore,
                                  String fromObjectUri,
                                  IModelStore toStore)
        Parameters:
        fromStore - Store copied from
        fromObjectUri - Object URI in the from tsotre
        toStore - store copied to
        Returns:
        the objectId which has already been copied, or null if it has not been copied
      • putCopiedId

        String putCopiedId​(IModelStore fromStore,
                           String fromObjectUri,
                           IModelStore toStore,
                           String toObjectUri)
        Record a copied ID between model stores
        Parameters:
        fromStore - Store copied from
        fromObjectUri - URI for the from Object
        toObjectUri - URI for the to Object
        Returns:
        any copied to ID for the same stores, URI's, nameSpace and fromID