Skip to content
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

issue #3576 - remove unnecessary guard against null resourceId #3580

Merged
merged 1 commit into from
Apr 20, 2022

Conversation

lmsurpre
Copy link
Member

@lmsurpre lmsurpre commented Apr 19, 2022

Now that our persistence layer requires resources to have proper
metadata (id, versionId, and lastUpdated) prior to calling create/update/delete, I thought that resources
will always have an id before we call the persistence interceptors.

However, it turns out that we call the beforeCreate from the REST layer
BEFORE setting this metadata on the resource.
After a brief discussion, we decided to leave that as-is and update the
interceptor to allow a null resourceId.

Signed-off-by: Lee Surprenant lmsurpre@us.ibm.com

Now that our persistence layer requires resources to have proper
metadata prior to calling create/update/delete, I thought that resources
will always have an id before we call the persistence interceptors.

However, it turns out that we call the beforeCreate from the REST layer
BEFORE setting this metadata on the resource.
After a brief discussion, we decided to leave that as-is and update the
interceptor to allow a null id.

Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
@lmsurpre lmsurpre changed the title issue #3576 - remove unnecessary check for null ids issue #3576 - remove unnecessary guard against null resourceId Apr 19, 2022
@@ -195,7 +195,7 @@ public FHIRRestHelper(FHIRPersistence persistence, SearchHelper searchHelper) {

@Override
public FHIRRestOperationResponse doCreate(String type, Resource resource, String ifNoneExist,
boolean doValidation) throws Exception {
boolean doValidation) throws Exception {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated formatting changes i had in my workspace

@@ -954,7 +957,7 @@ private boolean isInCompartment(String resourceType, String resourceId, Resource
for (String searchParmCode : inclusionCriteria) {
try {
SearchParameter inclusionParm = searchHelper.getSearchParameter(resourceType, searchParmCode);
if (inclusionParm != null & inclusionParm.getExpression() != null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ouch

Copy link
Collaborator

@punktilious punktilious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lmsurpre lmsurpre merged commit b508492 into main Apr 20, 2022
@lmsurpre lmsurpre deleted the issue-3576 branch April 20, 2022 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants