-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FRI-127 #328
FRI-127 #328
Conversation
public Branch setAuthorFlag(String branchPath, SetAuthorFlag setAuthorFlag) { | ||
Branch branch = branchService.findBranchOrThrow(branchPath); | ||
|
||
Metadata metadata = branch.getMetadata(); | ||
Map<String, String> authFlagMap = metadata.getMapOrCreate(AUTHOR_FLAGS_METADATA_KEY); | ||
authFlagMap.put(setAuthorFlag.getName(), String.valueOf(setAuthorFlag.isValue())); | ||
metadata.putMap(AUTHOR_FLAGS_METADATA_KEY, authFlagMap); | ||
|
||
return branchService.updateMetadata(branchPath, metadata); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic was previously in BranchController
, however I needed it in another place (ConceptService
).
I originally tried injecting the controller to the service, but that caused a circular dependency so I moved the logic to a separate service class.
Branch branch = branchService.findBranchOrThrow(branchPath); | ||
|
||
String name = setAuthorFlag.getName(); | ||
String value = String.valueOf(setAuthorFlag.isValue()); | ||
if (name == null || name.isEmpty()) { | ||
throw new IllegalArgumentException("Name for author flag not present"); | ||
} | ||
|
||
Metadata metadata = branch.getMetadata(); | ||
Map<String, String> authFlagMap = metadata.getMapOrCreate(AUTHOR_FLAGS_METADATA_KEY); | ||
authFlagMap.put(name, value); | ||
metadata.putMap(AUTHOR_FLAGS_METADATA_KEY, authFlagMap); | ||
|
||
return getBranchPojo(branchService.updateMetadata(branchPath, metadata)); | ||
return getBranchPojo(sBranchService.setAuthorFlag(branchPath, setAuthorFlag)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been updated to use the new service method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was moved to a service class as it was needed in several places. After speaking with @kaicode , the code was no longer needed in the second place (still required in the controller). However, I've kept the change as it minimises the logic in the controller.
|
||
Map<String, String> authFlagMap = metadata.getMapOrCreate(AUTHOR_FLAGS_METADATA_KEY); | ||
authFlagMap.put(BATCH_CHANGE_KEY, "true"); | ||
metadata.putMap(AUTHOR_FLAGS_METADATA_KEY, authFlagMap); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When importing, the flag will be set on the branch.
89e9a53
to
5d1e0ba
Compare
|
||
boolean codeSystem = codeSystemService.findByBranchPath(branchPath).isPresent(); | ||
if (!codeSystem) { | ||
Map<String, String> authFlagMap = metadata.getMapOrCreate(AUTHOR_FLAGS_METADATA_KEY); | ||
authFlagMap.put(BATCH_CHANGE_KEY, "true"); | ||
metadata.putMap(AUTHOR_FLAGS_METADATA_KEY, authFlagMap); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kaicode , I have added this codeSystem condition check after our chat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flag will now only be set when not importing at the CodeSystem level.
FRI-127 When importing RF2, do not set flag on code system
5d1e0ba
to
1b5ff47
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
FRI-127 is concerned with returning certain criteria from authoring-acceptance-gateway whenever a snowstorm branch is flagged as having had content added via a batch process.
Snowstorm will set the appropriate flag whenever the import function is run or when updating/creating Concepts in bulk. This flag will later be picked up by authoring-acceptance-gateway.
This feature is spanned across several services. Please see below all pull requests.
Snowstorm
Reporting Engine
Authoring Acceptance Gateway