Class ModelCopyManager

java.lang.Object
org.spdx.library.ModelCopyManager

public class ModelCopyManager
extends Object
This class helps facilitate copying objects from one model to another. In addition to the copy functions (methods), this object keeps track of what was copied where so that the same object is not copied twice. This object can be passed into the constructor for ModelObjects to allow the objects to be copied.
Author:
Gary O'Neall
  • Constructor Details

    • ModelCopyManager

      public ModelCopyManager()
      Create a ModelCopyManager with default options
  • Method Details

    • getCopiedId

      public String getCopiedId​(IModelStore fromStore, String fromDocumentUri, String fromId, IModelStore toStore, String toDocumentUri)
      Parameters:
      fromStore - Store copied from
      fromDocumentUri - document copied from
      fromId - ID copied from
      toStore - store copied to
      toDocumentUri - document copied to
      Returns:
      the ID which has already been copied, or null if it has not been copied
    • putCopiedId

      public String putCopiedId​(IModelStore fromStore, String fromDocumentUri, String fromId, IModelStore toStore, String toDocumentUri, String toId)
      Record a copied ID between model stores
      Parameters:
      fromStore - Store copied from
      fromDocumentUri - document copied from
      fromId - ID copied from
      toStore - store copied to
      toDocumentUri - document copied to
      toId - ID copied to
      Returns:
      any copied to ID for the same stores, URI's and fromID
    • copy

      public void copy​(IModelStore toStore, String toDocumentUri, String toId, IModelStore fromStore, String fromDocumentUri, String fromId, String type) throws InvalidSPDXAnalysisException
      Copy an item from one Model Object Store to another
      Parameters:
      toStore - Model Store to copy to
      toId - Id to use in the copy
      toDocumentUri - Target document URI
      fromStore - Model Store containing the source item
      fromDocumentUri - Document URI for the source item
      fromId - ID source ID
      type - Type to copy
      Throws:
      InvalidSPDXAnalysisException
    • copy

      public TypedValue copy​(IModelStore toStore, String toDocumentUri, IModelStore fromStore, String fromDocumentUri, String sourceId, String type) 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
      toDocumentUri - Target document URI
      fromStore - Model Store containing the source item
      fromDocumentUri - Document URI for the source item
      sourceId - ID source ID
      type - Type to copy
      Returns:
      ID for the copied object
      Throws:
      InvalidSPDXAnalysisException