Skip to content

Commit

Permalink
issue #3855 - remove "ibm" from prefix for internal compartment params
Browse files Browse the repository at this point in the history
and various other updates to avoid "ibm-" references in the code

Signed-off-by: Lee Surprenant <lmsurpre@merative.com>
  • Loading branch information
lmsurpre committed Aug 9, 2022
1 parent b265b2a commit dc733e0
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 49 deletions.
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "ibm-fhir-server-site",
"name": "fhir-server-site",
"version": "1.0.1",
"license": "Apache-2.0",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,26 +128,32 @@ public void setConfigData(ConfigData configData) {
this.configData = configData;
}

@Deprecated
public String getClientCertCn() {
return clientCertCn;
}

@Deprecated
public void setClientCertCn(String clientCertCn) {
this.clientCertCn = clientCertCn;
}

@Deprecated
public String getClientCertIssuerOu() {
return clientCertIssuerOu;
}

@Deprecated
public void setClientCertIssuerOu(String clientCertIssuerOu) {
this.clientCertIssuerOu = clientCertIssuerOu;
}

@Deprecated
public String getCorrelationId() {
return correlationId;
}

@Deprecated
public void setCorrelationId(String correlationId) {
this.correlationId = correlationId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public enum Index {
/**
* Both R4 spec and IBM generated examples
*/
ALL_XML("/spec-xml.txt", "/ibm-xml.txt"),
ALL_XML("/spec-xml.txt", "/generated-xml.txt"),

/**
* Small mix of spec and IBM examples used for unit tests to keep build times short
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2138,7 +2138,7 @@ private boolean isWholeSystem(SearchParameter sp) {
}

/**
* Augment the given allParameters list with ibm-internal parameters that represent the relationship
* Augment the given allParameters list with internal parameters that represent the relationship
* between the fhirResource and its compartments. These parameter values are subsequently used
* to improve the performance of compartment-based FHIR search queries. See
* {@link CompartmentHelper#makeCompartmentParamName(String)} for details on how the
Expand Down Expand Up @@ -2206,7 +2206,7 @@ protected void addCompartmentParams(List<ExtractedParameterValue> allParameters,
}

/**
* Augment the given allParameters list with ibm-internal parameters that represent the relationship
* Augment the given allParameters list with internal parameters that represent the relationship
* between the url and version parameters. These parameter values are subsequently used in
* canonical reference searches. See {@link CompartmentHelper#makeCompartmentParamName(String)} for
* details on how the parameter name is composed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public boolean visit(java.lang.String elementName, int elementIndex, org.linuxfo
// See SearchUtil#parseQueryParameterValuesString.
if (system == null) {
// Can't find an explicit system, so see if there's an implicit one
// attached to the code as an (IBM-defined) extension.
// attached to the code as an (LinuxForHealth-defined) extension.
system = SearchHelper.findImplicitSystem(code.getExtension());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,11 @@ has-member
has-member:identifier
holder
holder:identifier
ibm-internal-Device-Compartment
ibm-internal-Encounter-Compartment
ibm-internal-Patient-Compartment
ibm-internal-Practitioner-Compartment
ibm-internal-RelatedPerson-Compartment
internal-Device-Compartment
internal-Encounter-Compartment
internal-Patient-Compartment
internal-Practitioner-Compartment
internal-RelatedPerson-Compartment
ibm_composite_accession:of-type_type
ibm_composite_accession:of-type_value
ibm_composite_base_canonical_uri
Expand Down Expand Up @@ -829,4 +829,4 @@ substance-code
substance-code:text
substance-definition
trigger-description
# End of 4.1.0
# End of 4.3.0
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public Map<String, Set<java.lang.String>> getCompartmentParamsForResourceType(ja
*/
public static String makeCompartmentParamName(String compartmentName) {
final StringBuilder result = new StringBuilder();
result.append("ibm-internal-")
result.append("internal-")
.append(compartmentName)
.append("-Compartment");
return result.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
* Test the parsing of compartment related search data from SearchHelper.
*/
public class CompartmentParseQueryParmsTest extends BaseSearchTest {
private static final String INTERNAL_PATIENT_COMPARTMENT_PARAM = "ibm-internal-Patient-Compartment";
private static final String INTERNAL_RELATEDPERSON_COMPARTMENT_PARAM = "ibm-internal-RelatedPerson-Compartment";
private static final String INTERNAL_PATIENT_COMPARTMENT_PARAM = "internal-Patient-Compartment";
private static final String INTERNAL_RELATEDPERSON_COMPARTMENT_PARAM = "internal-RelatedPerson-Compartment";

/**
* This method tests parsing compartment related query parms, passing an invalid compartment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
<databaseStore dataSourceRef="fhirbatchDS" id="BatchDatabaseStore" schema="${BATCH_DB_SCHEMA}" tablePrefix="" createTables="false"/>

<!--
The defaultHostName is set in the deployment.yaml https://github.com/Alvearie/alvearie-helm/blob/main/charts/ibm-fhir-server/templates/deployment.yaml#L159
and is subsequently used by the bulkdata configurations
The defaultHostName is subsequently used in the bulkdata configuration and must be set to avoid liberty batch issues.
For example, in the helm chart:
https://github.com/Alvearie/alvearie-helm/blob/main/charts/ibm-fhir-server/templates/deployment.yaml#L179
-->
<variable name="defaultHostName" value="${env.MY_POD_NAME}"/>
</server>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<server>
<!-- ============================================================== -->
<!-- This datasource aligns with the Apache Derby database that is -->
<!-- created by the ibmcom/ibm-fhir-server BOOTSTRAP_DB process. -->
<!-- created by the linuxforhealth/fhir-server BOOTSTRAP_DB process.-->
<!-- ============================================================== -->

<!-- ============================================================== -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
package org.linuxforhealth.fhir.server.util;

import java.security.Principal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand Down Expand Up @@ -56,11 +54,6 @@ public class RestAuditLogger {
private static final String CLASSNAME = RestAuditLogger.class.getName();
private static final Logger log = java.util.logging.Logger.getLogger(CLASSNAME);

private static final String HEADER_IBM_APP_USER = "IBM-App-User";
private static final String HEADER_CLIENT_CERT_CN = "IBM-App-cli-CN";
private static final String HEADER_CLIENT_CERT_ISSUER_OU = "IBM-App-iss-OU";
private static final String HEADER_CORRELATION_ID = "IBM-DP-correlationid";

private static final String COMPONENT_ID = "fhir-server";

private static final IPHandler componentIpHandler = new IPHandler();
Expand Down Expand Up @@ -370,16 +363,16 @@ public static void logBundle(HttpServletRequest request, Bundle requestBundle, B
// Transaction
logBundleTransaction(auditLogSvc, request, requestBundle, responseBundle, startTime, endTime, responseStatus);
}

}
log.exiting(CLASSNAME, METHODNAME);
}

/**
* Logs the Bundle as a batch in multiple messages
*
* @implNote batch fail or succeed as a individual processing unit.
*
*
* @implNote batch fail or succeed as a individual processing unit.
*
* @param auditLogSvc
* @param request
* @param requestBundle
Expand All @@ -401,7 +394,7 @@ private static void logBundleBatch(AuditLogService auditLogSvc, HttpServletReque

AuditLogEntry entry = initLogEntry(AuditLogEventType.FHIR_BUNDLE);

populateAuditLogEntry(entry, request, responseEntry.getResource(), startTime, endTime, responseStatus);
populateAuditLogEntry(entry, request, responseEntry.getResource(), startTime, endTime, responseStatus);
if (requestEntry.getRequest() != null && requestEntry.getRequest().getMethod() != null) {
boolean operation = requestEntry.getRequest().getUrl().getValue().contains("$")
|| requestEntry.getRequest().getUrl().getValue().contains("/%24");
Expand Down Expand Up @@ -489,9 +482,9 @@ private static void logBundleBatch(AuditLogService auditLogSvc, HttpServletReque

/**
* Logs the Bundle as a Transaction in a single request
*
* @implNote transactions fail or succeed as a single processing unit.
*
*
* @implNote transactions fail or succeed as a single processing unit.
*
* @param auditLogSvc
* @param request
* @param requestBundle
Expand Down Expand Up @@ -788,21 +781,11 @@ protected static AuditLogEntry populateAuditLogEntry(AuditLogEntry entry, HttpSe
log.entering(CLASSNAME, METHODNAME);

String patientIdExtUrl;
List<String> userList = new ArrayList<>();

// Build a list of possible user names. Pick the first non-null user name to include in the audit log entry.
userList.add(request.getHeader(HEADER_IBM_APP_USER));
userList.add(request.getHeader(HEADER_CLIENT_CERT_CN));

// Note: we used to support overriding the user name from a specific header; that was removed for 5.0
Principal userPrincipal = request.getUserPrincipal();
if (userPrincipal != null) {
userList.add(userPrincipal.getName());
}
for (String userName : userList) {
if (userName != null && !userName.isEmpty()) {
entry.setUserName(userName);
break;
}
entry.setUserName(userPrincipal.getName());
}

entry.setLocation(new StringBuilder().append(request.getRemoteAddr()).append("/").append(request.getRemoteHost()).toString());
Expand All @@ -827,10 +810,6 @@ protected static AuditLogEntry populateAuditLogEntry(AuditLogEntry entry, HttpSe
}
}

entry.setClientCertCn(request.getHeader(HEADER_CLIENT_CERT_CN));
entry.setClientCertIssuerOu(request.getHeader(HEADER_CLIENT_CERT_ISSUER_OU));
entry.setCorrelationId(request.getHeader(HEADER_CORRELATION_ID));

patientIdExtUrl = FHIRConfigHelper.getStringProperty(FHIRConfiguration.PROPERTY_AUDIT_PATIENT_ID_EXTURL, null);
entry.setPatientId(FHIRUtil.getExtensionStringValue(resource, patientIdExtUrl));
entry.getContext().setRequestUniqueId(FHIRRequestContext.get().getRequestUniqueId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ public void testBeforeSearch(String scopeString, List<String> contextIds, Set<Re
assertEquals(searchContext.getSearchParameters().size(), 2);
List<QueryParameter> searchParms = searchContext.getSearchParameters();
QueryParameter compartmentSearchParm = searchParms.get(0);
assertTrue("ibm-internal-Patient-Compartment".equals(compartmentSearchParm.getCode()));
assertTrue("internal-Patient-Compartment".equals(compartmentSearchParm.getCode()));
assertEquals(compartmentSearchParm.getType(), Type.REFERENCE);
assertTrue(compartmentSearchParm.isInclusionCriteria());
assertFalse(compartmentSearchParm.isChained());
Expand Down

0 comments on commit dc733e0

Please sign in to comment.