Package org.damap.base.rest.dmp.service
Class DmpConsistencyUtility
java.lang.Object
org.damap.base.rest.dmp.service.DmpConsistencyUtility
DmpConsistencyUtility class.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidenforceActiveStorage(DmpDO newDmp, Dmp oldDmp, InternalStorageService internalStorageService) Validates that all internal storage used in the new DMP are active.voidenforceDmpConsistency(DmpDO dmpDO) Adapts a given DMP so that it's information is consistent.
-
Constructor Details
-
DmpConsistencyUtility
public DmpConsistencyUtility()
-
-
Method Details
-
enforceDmpConsistency
Adapts a given DMP so that it's information is consistent.- Parameters:
dmpDO- the DMP to check and adapt.
-
enforceActiveStorage
public void enforceActiveStorage(DmpDO newDmp, Dmp oldDmp, InternalStorageService internalStorageService) throws jakarta.validation.ValidationException Validates that all internal storage used in the new DMP are active. If there is no old DMP, it retrieves the storage IDs from the new DMP and checks their active status using theInternalStorageService. If comparing with an old DMP, the method checks any new storage IDs added in the new DMP and ensures they are active. If any storage is inactive, aValidationExceptionis thrown. A storage that is already in the old DMP is not checked for active status.- Parameters:
newDmp- the new DMPoldDmp- the old DMPinternalStorageService- the internal storage service- Throws:
jakarta.validation.ValidationException- if at least one storage is not active
-