Skip to content

Commit

Permalink
Merge pull request #281 from TAMULib/sprint4-275-research-pdac-tracking
Browse files Browse the repository at this point in the history
[275] Research Project chain of custody tracking
  • Loading branch information
jsavell authored Sep 5, 2024
2 parents afddf67 + 809e861 commit 7ef0006
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -129,7 +130,6 @@ public Relationship create(Context context, Relationship relationship) throws SQ
Relationship relationshipToReturn = relationshipDAO.create(context, relationship);
updatePlaceInRelationship(context, relationshipToReturn, null, null, true, true);
update(context, relationshipToReturn);

//TAMU Customization - Track PDAC chain of custody for RDS
updatePdacChainOfCustody(PdacActionType.ADD, relationship, context);
//End TAMU Customization - Track PDAC chain of custody for RDS
Expand Down Expand Up @@ -1135,15 +1135,16 @@ public int countByItemRelationshipTypeAndRelatedList(Context context, UUID focus

// TAMU Customization - Track changes to PDAC custody via metadata
protected void updatePdacChainOfCustody(PdacActionType pdacActionType, Relationship relationship, Context context) {
final String validLeftType = "isPDACForDataset";
final String validRightType = "isDatasetAssignedToPDAC";
final List<String> validLeftTypes = Arrays.asList("isPDACForDataset", "isPDACForProject");
final List<String> validRightTypes = Arrays.asList("isDatasetAssignedToPDAC","isProjectAssignedtoPDAC");
final String mdSchema = MetadataSchemaEnum.DC.getName();
final String mdElement = "description";
final String mdQualifier = "chainOfCustody";

// verify that this is a pdac relationship
if (relationship.getRelationshipType().getLeftwardType().equals(validLeftType)
&& relationship.getRelationshipType().getRightwardType().equals(validRightType)) {
if (validLeftTypes.contains(relationship.getRelationshipType().getLeftwardType())
&& validRightTypes.contains(relationship.getRelationshipType().getRightwardType())) {

final String mdLanguage = "en";
final String timeOfAction = java.time.format.DateTimeFormatter.ISO_DATE_TIME
.format(java.time.LocalDateTime.now());
Expand Down

0 comments on commit 7ef0006

Please sign in to comment.