Package org.spdx.library
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 Summary
Constructors Constructor Description ModelCopyManager()Create a ModelCopyManager with default options -
Method Summary
Modifier and Type Method Description voidcopy(IModelStore toStore, String toDocumentUri, String toId, IModelStore fromStore, String fromDocumentUri, String fromId, String type)Copy an item from one Model Object Store to anothervoidcopy(IModelStore toStore, String toDocumentUri, String toId, IModelStore fromStore, String fromDocumentUri, String fromId, String type, boolean excludeLicenseDetails)Copy an item from one Model Object Store to anotherTypedValuecopy(IModelStore toStore, String toDocumentUri, IModelStore fromStore, String fromDocumentUri, String sourceId, String type)Copy an item from one Model Object Store to another using the source ID for the target unless it is anonymousTypedValuecopy(IModelStore toStore, String toDocumentUri, IModelStore fromStore, String fromDocumentUri, String sourceId, String type, boolean excludeLicenseDetails)Copy an item from one Model Object Store to another using the source ID for the target unless it is anonymousStringgetCopiedId(IModelStore fromStore, String fromDocumentUri, String fromId, IModelStore toStore, String toDocumentUri)StringputCopiedId(IModelStore fromStore, String fromDocumentUri, String fromId, IModelStore toStore, String toDocumentUri, String toId)Record a copied ID between model stores
-
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 fromfromDocumentUri- document copied fromfromId- ID copied fromtoStore- store copied totoDocumentUri- 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 fromfromDocumentUri- document copied fromfromId- ID copied fromtoStore- store copied totoDocumentUri- document copied totoId- 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 InvalidSPDXAnalysisExceptionCopy an item from one Model Object Store to another- Parameters:
toStore- Model Store to copy totoId- Id to use in the copytoDocumentUri- Target document URIfromStore- Model Store containing the source itemfromDocumentUri- Document URI for the source itemfromId- ID source IDtype- Type to copy- Throws:
InvalidSPDXAnalysisException
-
copy
public void copy(IModelStore toStore, String toDocumentUri, String toId, IModelStore fromStore, String fromDocumentUri, String fromId, String type, boolean excludeLicenseDetails) throws InvalidSPDXAnalysisExceptionCopy an item from one Model Object Store to another- Parameters:
toStore- Model Store to copy totoId- Id to use in the copytoDocumentUri- Target document URIfromStore- Model Store containing the source itemfromDocumentUri- Document URI for the source itemfromId- ID source IDtype- Type to copyexcludeLicenseDetails- If true, don't copy over properties of the listed licenses- Throws:
InvalidSPDXAnalysisException
-
copy
public TypedValue copy(IModelStore toStore, String toDocumentUri, IModelStore fromStore, String fromDocumentUri, String sourceId, String type) throws InvalidSPDXAnalysisExceptionCopy 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 totoDocumentUri- Target document URIfromStore- Model Store containing the source itemfromDocumentUri- Document URI for the source itemsourceId- ID source IDtype- Type to copy- Returns:
- ID for the copied object
- Throws:
InvalidSPDXAnalysisException
-
copy
public TypedValue copy(IModelStore toStore, String toDocumentUri, IModelStore fromStore, String fromDocumentUri, String sourceId, String type, boolean excludeLicenseDetails) throws InvalidSPDXAnalysisExceptionCopy 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 totoDocumentUri- Target document URIfromStore- Model Store containing the source itemfromDocumentUri- Document URI for the source itemsourceId- ID source IDtype- Type to copyexcludeLicenseDetails- If true, don't copy over properties of the listed licenses- Returns:
- ID for the copied object
- Throws:
InvalidSPDXAnalysisException
-