Addressing review comments.

This commit is contained in:
Diederik Muylwyk 2019-08-01 13:37:46 -04:00
parent ffda92514a
commit 78842164fd
4 changed files with 26 additions and 7 deletions

View File

@ -35,8 +35,12 @@ import java.util.List;
import static org.apache.commons.lang3.StringUtils.left;
import static org.apache.commons.lang3.StringUtils.length;
@Table(name = "TRM_VALUESET_CONCEPT", indexes = {
@Index(name = "IDX_VALUESET_CONCEPT_CS_CD", columnList = "SYSTEM_URL, CODEVAL")
/*
* DM 2019-08-01 - Do not use IDX_VALUESET_CONCEPT_CS_CD; this was previously used as an index so reusing the name will
* bork up migration tasks.
*/
@Table(name = "TRM_VALUESET_CONCEPT", uniqueConstraints = {
@UniqueConstraint(name = "IDX_VS_CONCEPT_CS_CD", columnNames = {"VALUESET_PID", "SYSTEM_URL", "CODEVAL"})
})
@Entity()
public class TermValueSetConcept implements Serializable {

View File

@ -20,10 +20,23 @@ package ca.uhn.fhir.jpa.entity;
* #L%
*/
/**
* This enum is used to indicate the expansion status of a given ValueSet in the terminology tables. In this context,
* an expanded ValueSet has its included concepts stored in the terminology tables as well.
*/
public enum TermValueSetExpansionStatusEnum {
/**
* This status indicates the ValueSet is waiting to be picked up and expanded by a scheduled task.
*/
NOT_EXPANDED,
/**
* This status indicates the ValueSet has been picked up by a scheduled task and is mid-expansion.
*/
EXPANSION_IN_PROGRESS,
/**
* This status indicates the ValueSet has been picked up by a scheduled task and expansion is complete.
*/
EXPANDED
}

View File

@ -1496,7 +1496,6 @@ public abstract class BaseHapiTerminologySvcImpl implements IHapiTerminologySvc,
}
@Scheduled(fixedDelay = 600000) // 10 minutes.
@Transactional
@Override
public synchronized void preExpandValueSetToTerminologyTables() {
new TransactionTemplate(myTxManager).execute(new TransactionCallbackWithoutResult() {

View File

@ -133,15 +133,18 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
.references("TRM_VALUESET", "PID");
termValueSetConceptTable.addColumn("SYSTEM_URL").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, TermCodeSystem.MAX_URL_LENGTH);
termValueSetConceptTable.addColumn("CODEVAL").nonNullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, TermConcept.MAX_CODE_LENGTH);
termValueSetConceptTable
.addIndex("IDX_VALUESET_CONCEPT_CS_CD")
.unique(false)
.withColumns("SYSTEM_URL", "CODEVAL");
termValueSetConceptTable.addColumn("DISPLAY").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, TermConcept.MAX_DESC_LENGTH);
version.onTable("TRM_VALUESET_CONCEPT")
.renameColumn("CODE", "CODEVAL", true, true)
.renameColumn("SYSTEM", "SYSTEM_URL", true, true);
version.startSectionWithMessage("Processing table: TRM_VALUESET_CONCEPT, swapping index for unique constraint");
termValueSetConceptTable.dropIndex("IDX_VALUESET_CONCEPT_CS_CD");
termValueSetConceptTable
.addIndex("IDX_VS_CONCEPT_CS_CD")
.unique(true)
.withColumns("VALUESET_PID", "SYSTEM_URL", "CODEVAL");
// TermValueSetConceptDesignation
version.startSectionWithMessage("Processing table: TRM_VALUESET_C_DESIGNATION");
version.addIdGenerator("SEQ_VALUESET_C_DSGNTN_PID");