Added TRM_VALUESET.EXPANSION_STATUS column, index, fields to entity, and migration tasks.

This commit is contained in:
Diederik Muylwyk 2019-07-29 19:30:46 -04:00
parent a4ca5374ec
commit a8489f4331
4 changed files with 54 additions and 1 deletions

View File

@ -43,6 +43,7 @@ import static org.apache.commons.lang3.StringUtils.length;
public class TermValueSet implements Serializable {
private static final long serialVersionUID = 1L;
public static final int MAX_EXPANSION_STATUS_LENGTH = 50;
public static final int MAX_NAME_LENGTH = 200;
public static final int MAX_URL_LENGTH = 200;
@ -68,6 +69,15 @@ public class TermValueSet implements Serializable {
@OneToMany(mappedBy = "myValueSet")
private List<TermValueSetConcept> myConcepts;
@Enumerated(EnumType.STRING)
@Column(name = "EXPANSION_STATUS", nullable = false, length = MAX_EXPANSION_STATUS_LENGTH)
private TermValueSetExpansionStatusEnum myExpansionStatus;
public TermValueSet() {
super();
myExpansionStatus = TermValueSetExpansionStatusEnum.NOT_EXPANDED;
}
public Long getId() {
return myId;
}
@ -110,6 +120,14 @@ public class TermValueSet implements Serializable {
return myConcepts;
}
public TermValueSetExpansionStatusEnum getExpansionStatus() {
return myExpansionStatus;
}
public void setExpansionStatus(TermValueSetExpansionStatusEnum theExpansionStatus) {
myExpansionStatus = theExpansionStatus;
}
@Override
public boolean equals(Object theO) {
if (this == theO) return true;
@ -139,6 +157,7 @@ public class TermValueSet implements Serializable {
.append("myResourcePid", myResourcePid)
.append("myName", myName)
.append(myConcepts != null ? ("myConcepts - size=" + myConcepts.size()) : ("myConcepts=(null)"))
.append("myExpansionStatus", myExpansionStatus)
.toString();
}
}

View File

@ -0,0 +1,29 @@
package ca.uhn.fhir.jpa.entity;
/*
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2019 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
public enum TermValueSetExpansionStatusEnum {
NOT_EXPANDED,
EXPANSION_IN_PROGRESS,
EXPANDED
}

View File

@ -7,7 +7,6 @@ import ca.uhn.fhir.jpa.entity.*;
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.param.StringParam;
import ca.uhn.fhir.rest.param.UriParam;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
@ -964,6 +963,7 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
assertEquals("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2", valueSet.getUrl());
assertEquals("Terminology Services Connectation #1 Extensional case #2", valueSet.getName());
assertEquals(codeSystem.getConcept().size(), valueSet.getConcepts().size());
assertEquals(TermValueSetExpansionStatusEnum.NOT_EXPANDED, valueSet.getExpansionStatus());
TermValueSetConcept concept = valueSet.getConcepts().get(0);
ourLog.info("Code:\n" + concept.toString());

View File

@ -115,6 +115,11 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
.toColumn("RES_ID")
.references("HFJ_RESOURCE", "RES_ID");
termValueSetTable.addColumn("NAME").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, TermValueSet.MAX_NAME_LENGTH);
termValueSetTable.addColumn("EXPANSION_STATUS").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, TermValueSet.MAX_EXPANSION_STATUS_LENGTH);
termValueSetTable
.addIndex("IDX_VALUESET_EXP_STATUS")
.unique(false)
.withColumns("EXPANSION_STATUS");
// TermValueSetConcept
version.startSectionWithMessage("Processing table: TRM_VALUESET_CONCEPT");