Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit b6466c3

Browse files
author
sowerstl
committed
Centralize data normalization logic, in prep for adding more.
1 parent c3adbf4 commit b6466c3

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/main/java/gov/osti/services/Metadata.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,7 @@ private Response doSave(String json, InputStream file, FormDataContentDispositio
13561356

13571357
em.getTransaction().begin();
13581358

1359-
removeRiDups(md);
1359+
performDataNormalization(md);
13601360

13611361
md.setWorkflowStatus(Status.Saved); // default to this
13621362
md.setOwner(user.getEmail()); // this User should OWN it
@@ -1462,7 +1462,7 @@ private Response doSubmit(String json, InputStream file, FormDataContentDisposit
14621462

14631463
em.getTransaction().begin();
14641464

1465-
removeRiDups(md);
1465+
performDataNormalization(md);
14661466

14671467
// set the ownership and workflow status
14681468
md.setOwner(user.getEmail());
@@ -1650,7 +1650,7 @@ private Response doAnnounce(String json, InputStream file, FormDataContentDispos
16501650

16511651
em.getTransaction().begin();
16521652

1653-
removeRiDups(md);
1653+
performDataNormalization(md);
16541654

16551655
// set the OWNER
16561656
md.setOwner(user.getEmail());
@@ -2160,6 +2160,15 @@ private void removeRiDups(DOECodeMetadata md) {
21602160
}
21612161
}
21622162

2163+
/**
2164+
* Normalize certain aspects of the data prior to storage.
2165+
*
2166+
* @param md the Metadata to normalize
2167+
*/
2168+
private void performDataNormalization(DOECodeMetadata md) {
2169+
removeRiDups(md);
2170+
}
2171+
21632172
/**
21642173
* Store a File to a specific directory location. All files associated with
21652174
* a CODEID are stored in the same folder.

0 commit comments

Comments
 (0)