[3020] add documentation/changelog

This commit is contained in:
katie_smilecdr 2021-09-24 14:49:07 -04:00
parent 8c145d1212
commit d067586607
4 changed files with 27 additions and 14 deletions

View File

@ -0,0 +1,4 @@
---
type: add
issue: 3020
title: "Added documentation for `$partition-management-read-partition`. Added `$partition-management-list-partitions` operation and documentation."

View File

@ -231,3 +231,17 @@ The following request body could be used:
}
```
# Listing all Partitions
The `$partition-management-list-partitions` operation can be used to list all existing partitions.
## Example
An HTTP POST to the following URL would be used to invoke this operation:
```url
http://example.com/DEFAULT/$partition-management-list-partitions
```

View File

@ -25,6 +25,7 @@ import ca.uhn.fhir.jpa.entity.PartitionEntity;
import ca.uhn.fhir.rest.annotation.Operation;
import ca.uhn.fhir.rest.annotation.OperationParam;
import ca.uhn.fhir.rest.annotation.ResourceParam;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.rest.server.provider.ProviderConstants;
import ca.uhn.fhir.util.ParametersUtil;
import org.hl7.fhir.instance.model.api.IBase;
@ -173,20 +174,16 @@ public class PartitionManagementProvider {
}
private IBaseParameters prepareOutputList(List<PartitionEntity> theOutput) {
if (theOutput != null) {
IBaseParameters retVal = ParametersUtil.newInstance(myCtx);
for (PartitionEntity partitionEntity : theOutput) {
IBase resultPart = ParametersUtil.addParameterToParameters(myCtx, retVal, "partition");
ParametersUtil.addPartInteger(myCtx, resultPart, ProviderConstants.PARTITION_MANAGEMENT_PARTITION_ID, partitionEntity.getId());
ParametersUtil.addPartCode(myCtx, resultPart, ProviderConstants.PARTITION_MANAGEMENT_PARTITION_NAME, partitionEntity.getName());
if (isNotBlank(partitionEntity.getDescription())) {
ParametersUtil.addPartString(myCtx, resultPart, ProviderConstants.PARTITION_MANAGEMENT_PARTITION_DESC, partitionEntity.getDescription());
}
IBaseParameters retVal = ParametersUtil.newInstance(myCtx);
for (PartitionEntity partitionEntity : theOutput) {
IBase resultPart = ParametersUtil.addParameterToParameters(myCtx, retVal, "partition");
ParametersUtil.addPartInteger(myCtx, resultPart, ProviderConstants.PARTITION_MANAGEMENT_PARTITION_ID, partitionEntity.getId());
ParametersUtil.addPartCode(myCtx, resultPart, ProviderConstants.PARTITION_MANAGEMENT_PARTITION_NAME, partitionEntity.getName());
if (isNotBlank(partitionEntity.getDescription())) {
ParametersUtil.addPartString(myCtx, resultPart, ProviderConstants.PARTITION_MANAGEMENT_PARTITION_DESC, partitionEntity.getDescription());
}
return retVal;
} else {
return null;
}
return retVal;
}
@Nonnull

View File

@ -257,7 +257,6 @@ public class PartitionManagementProviderTest {
partitionList.add(partition2);
when(myPartitionConfigSvc.listPartitions()).thenReturn(partitionList);
Parameters response = myClient
.operation()
.onServer()
@ -290,7 +289,6 @@ public class PartitionManagementProviderTest {
assertEquals("a description2", part.get(2).getValue().toString());
}
@Configuration
public static class MyConfig {