...
 
Commits (36)
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.ihtsdo.otf.refset</groupId>
<artifactId>refset-parent</artifactId>
<version>1.1.3_a</version>
<version>1.1.4</version>
<relativePath>../parent</relativePath>
</parent>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.ihtsdo.otf.refset</groupId>
<artifactId>refset-parent</artifactId>
<version>1.1.3_a</version>
<version>1.1.4</version>
<relativePath>../../parent</relativePath>
</parent>
......
......@@ -123,10 +123,10 @@ import.refset.handler=DEFAULT,RF1,DELTA
import.refset.handler.DEFAULT.class=org.ihtsdo.otf.refset.jpa.services.handlers.ImportRefsetRf2Handler
import.refset.handler.RF1.class=org.ihtsdo.otf.refset.jpa.services.handlers.ImportRefsetRf1Handler
import.refset.handler.DELTA.class=org.ihtsdo.otf.refset.jpa.services.handlers.ImportRefsetRf2DeltaHandler
export.refset.handler=DEFAULT,WITHNAME,EXCEL
export.refset.handler=DEFAULT,WITHNAME
export.refset.handler.DEFAULT.class=org.ihtsdo.otf.refset.jpa.services.handlers.ExportRefsetRf2Handler
export.refset.handler.WITHNAME.class=org.ihtsdo.otf.refset.jpa.services.handlers.ExportRefsetRf2WithNameHandler
export.refset.handler.EXCEL.class=org.ihtsdo.otf.refset.jpa.services.handlers.ExportRefsetRf2WithNameExcelHandler
#
# Translation I/O handlers
# - Multiple are allowed
......@@ -195,7 +195,7 @@ refset.config.label=
# Customize as needed for your environment
#
deploy.link=http://www.snomed.org
deploy.footer.copyright=Copyright @2017 SNOMED International
deploy.footer.copyright=Copyright @2019 SNOMED International
deploy.title= Reference Set and Translation Service
deploy.password.reset=n/a
deploy.presented.by=
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.ihtsdo.otf.refset</groupId>
<artifactId>refset-parent</artifactId>
<version>1.1.3_a</version>
<version>1.1.4</version>
<relativePath>../parent</relativePath>
</parent>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.ihtsdo.otf.refset</groupId>
<artifactId>refset-parent</artifactId>
<version>1.1.3_a</version>
<version>1.1.4</version>
<relativePath>../../parent</relativePath>
</parent>
......
......@@ -114,12 +114,11 @@ import.translation.handler=DEFAULT,DELTA
import.translation.handler.DEFAULT.class=org.ihtsdo.otf.refset.jpa.services.handlers.ImportTranslationRf2Handler
import.translation.handler.DELTA.class=org.ihtsdo.otf.refset.jpa.services.handlers.ImportTranslationRf2DeltaHandler
export.refset.handler=DEFAULT,WITHNAME,EXCEL
export.refset.handler=DEFAULT
export.refset.handler.DEFAULT.class=org.ihtsdo.otf.refset.jpa.services.handlers.ExportRefsetRf2Handler
export.refset.handler.WITHNAME.class=org.ihtsdo.otf.refset.jpa.services.handlers.ExportRefsetRf2WithNameHandler
export.refset.handler.EXCEL.class=org.ihtsdo.otf.refset.jpa.services.handlers.ExportRefsetRf2WithNameExcelHandler
export.translation.handler=DEFAULT
export.translation.handler=DEFAULT,WITHNAME
export.translation.handler.DEFAULT.class=org.ihtsdo.otf.refset.jpa.services.handlers.ExportTranslationRf2Handler
export.refset.handler.WITHNAME.class=org.ihtsdo.otf.refset.jpa.services.handlers.ExportRefsetRf2WithNameHandler
#
# Spelling
......@@ -143,7 +142,7 @@ help.url=https://confluence.ihtsdotools.org
# Used to determine the -Drefset.config.XXX label for execution environment, default is blank
refset.config.label=
deploy.link=http://westcoastinformatics.com
deploy.footer.copyright=Copyright @2017
deploy.footer.copyright=Copyright @2019
deploy.title= WCI Refset and Translation Tool
deploy.password.reset=n/a
deploy.presented.by=Presented by \
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.ihtsdo.otf.refset</groupId>
<artifactId>refset-parent</artifactId>
<version>1.1.3_a</version>
<version>1.1.4</version>
<relativePath>../../parent</relativePath>
</parent>
......
......@@ -114,12 +114,11 @@ import.translation.handler=DEFAULT,DELTA
import.translation.handler.DEFAULT.class=org.ihtsdo.otf.refset.jpa.services.handlers.ImportTranslationRf2Handler
import.translation.handler.DELTA.class=org.ihtsdo.otf.refset.jpa.services.handlers.ImportTranslationRf2DeltaHandler
export.refset.handler=DEFAULT,WITHNAME,EXCEL
export.refset.handler=DEFAULT
export.refset.handler.DEFAULT.class=org.ihtsdo.otf.refset.jpa.services.handlers.ExportRefsetRf2Handler
export.refset.handler.WITHNAME.class=org.ihtsdo.otf.refset.jpa.services.handlers.ExportRefsetRf2WithNameHandler
export.refset.handler.EXCEL.class=org.ihtsdo.otf.refset.jpa.services.handlers.ExportRefsetRf2WithNameExcelHandler
export.translation.handler=DEFAULT
export.translation.handler=DEFAULT,WITHNAME
export.translation.handler.DEFAULT.class=org.ihtsdo.otf.refset.jpa.services.handlers.ExportTranslationRf2Handler
export.refset.handler.WITHNAME.class=org.ihtsdo.otf.refset.jpa.services.handlers.ExportRefsetRf2WithNameHandler
#
# Spelling
......@@ -144,7 +143,7 @@ help.url=https://confluence.ihtsdotools.org/pages/viewpage.action?pageId=5505370
# Used to determine the -Drefset.config.XXX label for execution environment, default is blank
refset.config.label=
deploy.link=http://www.snomed.org
deploy.footer.copyright=Copyright @2017 SNOMED International
deploy.footer.copyright=Copyright @2019 SNOMED International
deploy.title= Reference Set and Translation Service
deploy.password.reset=https://ims.ihtsdotools.org/#/forgotpassword
deploy.presented.by=
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.ihtsdo.otf.refset</groupId>
<artifactId>refset-parent</artifactId>
<version>1.1.3_a</version>
<version>1.1.4</version>
<relativePath>../parent</relativePath>
</parent>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.ihtsdo.otf.refset</groupId>
<artifactId>refset-parent</artifactId>
<version>1.1.3_a</version>
<version>1.1.4</version>
<relativePath>../parent</relativePath>
</parent>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.ihtsdo.otf.refset</groupId>
<artifactId>refset-parent</artifactId>
<version>1.1.3_a</version>
<version>1.1.4</version>
<relativePath>../parent</relativePath>
</parent>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.ihtsdo.otf.refset</groupId>
<artifactId>refset-parent</artifactId>
<version>1.1.3_a</version>
<version>1.1.4</version>
<relativePath>../parent</relativePath>
</parent>
......
......@@ -7,7 +7,7 @@
<parent>
<groupId>org.ihtsdo.otf.refset</groupId>
<artifactId>refset-parent</artifactId>
<version>1.1.3_a</version>
<version>1.1.4</version>
<relativePath>../parent</relativePath>
</parent>
......
......@@ -177,7 +177,7 @@ public class PerformTranslationBetaAlgorithm extends TranslationServiceJpa
// Generate the delta release artifact and add it
releaseInfo = getCurrentTranslationReleaseInfo(
translation.getTerminologyId(), translation.getProject().getId());
translation, translation.getProject().getId());
if (releaseInfo != null) {
Logger.getLogger(getClass())
......
......@@ -1123,16 +1123,32 @@ public class TranslationServiceJpa extends RefsetServiceJpa
/* see superclass */
@Override
public ReleaseInfo getCurrentTranslationReleaseInfo(String terminologyId,
public ReleaseInfo getCurrentTranslationReleaseInfo(Translation translation,
Long projectId) throws Exception {
Logger.getLogger(getClass())
.debug("Release Service - get current release info for translation"
+ terminologyId + ", " + projectId);
+ translation + ", " + projectId);
// Get all release info for this terminologyId and projectId
final List<ReleaseInfo> results =
/*final List<ReleaseInfo> results =
findTranslationReleasesForQuery(null, "translationTerminologyId:"
+ terminologyId + " AND projectId:" + projectId, null).getObjects();
+ translation.getTerminologyId() + " AND projectId:" + projectId, null).getObjects();
*/
List<ReleaseInfo> results;
try {
javax.persistence.Query query =
manager.createQuery("select a from ReleaseInfoJpa a, TranslationJpa b "
+ " where b.name = :translationName and a.translation = b"
+ " and b.project.id = :projectId and b.terminologyId = :terminologyId");
//query.setParameter("terminologyId", translation.getTerminologyId());
query.setParameter("translationName", translation.getName());
query.setParameter("projectId", projectId);
query.setParameter("terminologyId", translation.getTerminologyId());
Logger.getLogger(getClass()).info("query*=" + query);
results = (List<ReleaseInfo>) query.getResultList();
} catch (NoResultException e) {
return null;
}
// Reverse sort releases by date
Collections.sort(results, new Comparator<ReleaseInfo>() {
......
......@@ -9,6 +9,7 @@ import java.util.Map.Entry;
import java.util.Properties;
import org.apache.log4j.Logger;
import org.ihtsdo.otf.refset.DefinitionClause;
import org.ihtsdo.otf.refset.Project;
import org.ihtsdo.otf.refset.Refset;
import org.ihtsdo.otf.refset.Translation;
......@@ -83,6 +84,7 @@ public class ValidationServiceJpa extends RootServiceJpa implements
result.merge(validationHandlersMap.get(key).validate(concept, service));
}
}
return result;
}
......@@ -127,7 +129,19 @@ public class ValidationServiceJpa extends RootServiceJpa implements
result.merge(validationHandlersMap.get(key).validate(refset, service));
}
}
// service.close();
if (refset.getDefinitionClauses() != null && refset.getDefinitionClauses().size() > 0) {
for (DefinitionClause definition : refset.getDefinitionClauses()) {
int ct = service.countExpression(project, refset.getTerminology(),
refset.getVersion(), definition.getValue());
if (ct > 40000) {
result.addError("Definition clause " + definition.getValue() + " resolves to more than 40000 results: " +
" This tool cannot manage refsets of that size reliably. Please revise your definition clause.");
} else if (ct > 20000) {
result.addWarning("Definition clause " + definition.getValue() + " resolves to more than 20000 results: " +
" Continuing with " + ct + " members may make the user experience inconsistent or unusable.");
}
}
}
return result;
}
......
......@@ -115,7 +115,7 @@ public class ExportTranslationRf2Handler implements ExportTranslationHandler {
descSb.append("\t");
}
descSb.append(description.isActive() ? "1" : "0").append("\t");
descSb.append(translation.getRefset().getModuleId()).append("\t");
descSb.append(translation.getModuleId()).append("\t");
descSb.append(concept.getTerminologyId()).append("\t");
descSb.append(description.getLanguageCode()).append("\t");
descSb.append(description.getTypeId()).append("\t");
......@@ -136,7 +136,7 @@ public class ExportTranslationRf2Handler implements ExportTranslationHandler {
langSb.append("\t");
}
langSb.append(member.isActive() ? "1" : "0").append("\t");
langSb.append(translation.getRefset().getModuleId()).append("\t");
langSb.append(translation.getModuleId()).append("\t");
langSb.append(translation.getRefset().getTerminologyId())
.append("\t");
langSb.append(description.getTerminologyId()).append("\t");
......@@ -224,7 +224,7 @@ public class ExportTranslationRf2Handler implements ExportTranslationHandler {
descSb.append("\t");
}
descSb.append(description.isActive() ? "1" : "0").append("\t");
descSb.append(translation.getRefset().getModuleId()).append("\t");
descSb.append(translation.getModuleId()).append("\t");
descSb.append(description.getConcept().getTerminologyId()).append("\t");
descSb.append(description.getLanguageCode()).append("\t");
descSb.append(description.getTypeId()).append("\t");
......@@ -244,7 +244,7 @@ public class ExportTranslationRf2Handler implements ExportTranslationHandler {
langSb.append("\t");
}
langSb.append(member.isActive() ? "1" : "0").append("\t");
langSb.append(translation.getRefset().getModuleId()).append("\t");
langSb.append(translation.getModuleId()).append("\t");
langSb.append(translation.getRefset().getTerminologyId()).append("\t");
langSb.append(member.getDescriptionId()).append("\t");
langSb.append(member.getAcceptabilityId());
......
......@@ -113,7 +113,13 @@ public class ImportRefsetRf1Handler implements ImportRefsetHandler {
setCommonFields(member, refset);
member.setConceptActive(true);
member.setRefset(refset);
member.setConceptId(fields[1]);
String conceptId = fields[1].trim();
if (!conceptId.equals(fields[1])) {
pbr.close();
throw new LocalException("Unexpected white space padding the concept id *"
+ fields[1] + "*");
}
member.setConceptId(conceptId);
member.setEffectiveTime(null);
// Add member
......
......@@ -143,7 +143,13 @@ public class ImportRefsetRf2DeltaHandler implements ImportRefsetHandler {
member.setTerminologyId(fields[0]);
member.setConceptActive(true);
member.setRefset(refset);
member.setConceptId(fields[5]);
String conceptId = fields[5].trim();
if (!conceptId.equals(fields[5])) {
pbr.close();
throw new LocalException("Unexpected white space padding the concept id *"
+ fields[5] + "*");
}
member.setConceptId(conceptId);
if (!fields[1].equals("")) {
try {
member.setEffectiveTime(ConfigUtility.DATE_FORMAT.parse(fields[1]));
......
......@@ -127,11 +127,17 @@ public class ImportRefsetRf2Handler implements ImportRefsetHandler {
setCommonFields(member, refset);
// save original ids if refset matches
if (refset.getTerminologyId().equals(fields[4])) {
member.setTerminologyId(fields[0]);
member.setTerminologyId(fields[0].trim());
}
member.setConceptActive(true);
member.setRefset(refset);
member.setConceptId(fields[5]);
String conceptId = fields[5].trim();
if (!conceptId.equals(fields[5])) {
pbr.close();
throw new LocalException("Unexpected white space padding the concept id *"
+ fields[5] + "*");
}
member.setConceptId(conceptId);
if (!fields[1].equals("")) {
try {
member.setEffectiveTime(ConfigUtility.DATE_FORMAT.parse(fields[1]));
......
......@@ -14,7 +14,6 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import org.apache.log4j.Logger;
import org.ihtsdo.otf.refset.Refset;
import org.ihtsdo.otf.refset.Translation;
import org.ihtsdo.otf.refset.ValidationResult;
import org.ihtsdo.otf.refset.helpers.ConfigUtility;
......@@ -154,7 +153,7 @@ public class ImportTranslationRf2DeltaHandler implements
// Create description and populate from RF2
final Description description = new DescriptionJpa();
setCommonFields(description, translation.getRefset());
setCommonFields(description, translation);
description.setActive(fields[2].equals("1"));
description.setTerminologyId(fields[0]);
if (!fields[1].equals("")) {
......@@ -171,7 +170,7 @@ public class ImportTranslationRf2DeltaHandler implements
if (!conceptCache.containsKey(fields[4])) {
conceptCache.put(fields[4], new ConceptJpa());
concept = conceptCache.get(fields[4]);
setCommonFields(concept, translation.getRefset());
setCommonFields(concept, translation);
if (!fields[1].equals("")) {
concept.setEffectiveTime(ConfigUtility.DATE_FORMAT
.parse(fields[1]));
......@@ -249,7 +248,7 @@ public class ImportTranslationRf2DeltaHandler implements
// Create and configure the member
final LanguageRefsetMember member = new LanguageRefsetMemberJpa();
setCommonFields(member, translation.getRefset());
setCommonFields(member, translation);
member.setActive(fields[2].equals("1"));
member.setTerminologyId(fields[0]);
if (!fields[1].equals("")) {
......@@ -346,7 +345,7 @@ public class ImportTranslationRf2DeltaHandler implements
concept = new ConceptJpa();
conceptCache.put(conceptId, concept);
concept = conceptCache.get(conceptId);
setCommonFields(concept, translation.getRefset());
setCommonFields(concept, translation);
concept.setEffectiveTime(description.getEffectiveTime());
concept.setTerminologyId(conceptId);
concept.setDefinitionStatusId("unknown");
......@@ -417,13 +416,13 @@ public class ImportTranslationRf2DeltaHandler implements
* @param refset the refset
*/
@SuppressWarnings("static-method")
private void setCommonFields(Component c, Refset refset) {
private void setCommonFields(Component c, Translation translation) {
c.setActive(true);
c.setEffectiveTime(null);
c.setId(null);
c.setPublishable(true);
c.setPublished(false);
c.setModuleId(refset.getModuleId());
c.setModuleId(translation.getModuleId());
}
@Override
......
......@@ -150,7 +150,7 @@ public class ImportTranslationRf2Handler implements ImportTranslationHandler {
throw new LocalException(
"Unexpected field count in descriptions file.");
}
if (!fields[0].equals(id)) {
if (!fields[0].endsWith(id)) {
// Skip inactive descriptions
if (fields[2].equals("0")) {
......@@ -227,7 +227,7 @@ public class ImportTranslationRf2Handler implements ImportTranslationHandler {
"Unexpected field count in language file.");
}
if (!fields[0].equals(id)) { // header
if (!fields[0].endsWith(id)) { // header
// Skip inactive language entries
if (fields[2].equals("0")) {
......@@ -243,10 +243,12 @@ public class ImportTranslationRf2Handler implements ImportTranslationHandler {
} else {
member.setTerminologyId(fields[0]);
}
if (!fields[1].equals("")) {
member.setEffectiveTime(
ConfigUtility.DATE_FORMAT.parse(fields[1]));
}
// Set from the translation refset
member.setRefsetId(translation.getRefset().getTerminologyId());
......
......@@ -643,11 +643,13 @@ public interface RefsetServiceRest {
* Export diff report.
*
* @param reportToken the report token
* @param terminology the terminology
* @param version the version
* @param authToken the auth token
* @return the input stream
* @throws Exception the exception
*/
public InputStream exportDiffReport(String reportToken, String authToken)
public InputStream exportDiffReport(String reportToken, String terminology, String version, String authToken)
throws Exception;
/**
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.ihtsdo.otf.refset</groupId>
<artifactId>refset-parent</artifactId>
<version>1.1.3_a</version>
<version>1.1.4</version>
<relativePath>../parent</relativePath>
</parent>
......
......@@ -7,7 +7,7 @@
<groupId>org.ihtsdo.otf.refset</groupId>
<artifactId>refset-parent</artifactId>
<version>1.1.3_a</version>
<version>1.1.4</version>
<packaging>pom</packaging>
<name>IHTSDO refset management service parent</name>
<description>Parent project. Used to define versions of third party modules</description>
......
......@@ -6,7 +6,7 @@
<!-- Module Metadata -->
<groupId>org.ihtsdo.otf.refset</groupId>
<artifactId>refset-aggregator</artifactId>
<version>1.1.3_a</version>
<version>1.1.4</version>
<packaging>pom</packaging>
<name>IHTSDO refset management service</name>
<description>Aggregator project.</description>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.ihtsdo.otf.refset</groupId>
<artifactId>refset-parent</artifactId>
<version>1.1.3_a</version>
<version>1.1.4</version>
<relativePath>../parent</relativePath>
</parent>
......
......@@ -1480,14 +1480,16 @@ public class RefsetClientRest extends RootClientRest
/* see superclass */
@Override
public InputStream exportDiffReport(String reportToken, String authToken)
public InputStream exportDiffReport(String reportToken, String terminology,
String version,String authToken)
throws Exception {
Logger.getLogger(getClass())
.debug("Refset Client - export diff report - " + reportToken);
Client client = ClientBuilder.newClient();
WebTarget target = client.target(config.getProperty("base.url")
+ "/refset/export/report" + "?reportToken=" + reportToken);
+ "/refset/export/report" + "?reportToken=" + reportToken +
"&terminology=" + terminology + "&version=" + version);
Response response = target.request(MediaType.APPLICATION_OCTET_STREAM)
.header("Authorization", authToken).get();
......
......@@ -7,7 +7,7 @@
<parent>
<groupId>org.ihtsdo.otf.refset</groupId>
<artifactId>refset-parent</artifactId>
<version>1.1.3_a</version>
<version>1.1.4</version>
<relativePath>../parent</relativePath>
</parent>
......
......@@ -124,6 +124,9 @@ public class RefsetServiceRestImpl extends RootServiceRestImpl
private static Map<String, MemberDiffReport> memberDiffReportMap =
new HashMap<>();
private Map<String, Concept> reasonMap = new HashMap<>();
/**
* Instantiates an empty {@link RefsetServiceRestImpl}.
*
......@@ -1043,11 +1046,13 @@ public class RefsetServiceRestImpl extends RootServiceRestImpl
@ApiOperation(value = "Export diff report", notes = "Exports the report during migration of a refset", response = InputStream.class)
public InputStream exportDiffReport(
@ApiParam(value = "Report token, (UUID format)", required = true) @QueryParam("reportToken") String reportToken,
@ApiParam(value = "Terminology", required = false) @QueryParam("terminology") String migrationTerminology,
@ApiParam(value = "Version", required = false) @QueryParam("version") String migrationVersion,
@ApiParam(value = "Authorization token, e.g. 'author1'", required = true) @HeaderParam("Authorization") String authToken)
throws Exception {
Logger.getLogger(getClass())
.info("RESTful call GET (Refset): /export/report " + reportToken);
.info("RESTful call GET (Refset): /export/report " + reportToken + " " + migrationTerminology + " " + migrationVersion);
final RefsetService refsetService =
new RefsetServiceJpa(getHeaders(headers));
......@@ -1077,6 +1082,9 @@ public class RefsetServiceRestImpl extends RootServiceRestImpl
sb = appendDiffReportMember(sb, member);
}
// Replacement Concepts
StringBuilder replacementConceptsSb = new StringBuilder();
// Old regular members
sb.append("\r\n").append("Old Members").append("\r\n");
if (report.getOldRegularMembers().size() > 0) {
......@@ -1087,6 +1095,15 @@ public class RefsetServiceRestImpl extends RootServiceRestImpl
for (ConceptRefsetMember member : report.getOldRegularMembers()) {
Logger.getLogger(getClass()).debug(" member = " + member);
sb = appendDiffReportMember(sb, member);
if (!member.isConceptActive() && report.getNewRefset().getType() == Type.INTENSIONAL) {
ConceptList conceptList = refsetService.getTerminologyHandler(member.getRefset().getProject(), getHeaders(headers))
.getReplacementConcepts(member.getConceptId(), migrationTerminology, migrationVersion);
for (Concept c : conceptList.getObjects()) {
replacementConceptsSb = appendReplacementConceptInfo(replacementConceptsSb, member, c,
refsetService, migrationTerminology, migrationVersion);
}
}
}
if (report.getNewRefset().getType() == Type.INTENSIONAL) {
......@@ -1161,14 +1178,35 @@ public class RefsetServiceRestImpl extends RootServiceRestImpl
}
}
// Members in common
sb.append("\r\n").append("Members in Common").append("\r\n");
sb = appendDiffReportHeader(sb);
// Members in common & Replacement Concepts
StringBuilder membersInCommonSb = new StringBuilder();
for (ConceptRefsetMember member : membersInCommonMap.get(reportToken)) {
Logger.getLogger(getClass()).debug(" member = " + member);
sb = appendDiffReportMember(sb, member);
membersInCommonSb = appendDiffReportMember(membersInCommonSb, member);
if (!member.isConceptActive()) {
ConceptList conceptList = refsetService.getTerminologyHandler(member.getRefset().getProject(), getHeaders(headers))
.getReplacementConcepts(member.getConceptId(), migrationTerminology, migrationVersion);
for (Concept c : conceptList.getObjects()) {
replacementConceptsSb = appendReplacementConceptInfo(replacementConceptsSb, member, c,
refsetService, migrationTerminology, migrationVersion);
}
}
}
sb.append("\r\n").append("Inactive Concepts with their suggested Replacement Concepts").append("\r\n");
if (replacementConceptsSb.length() > 0) {
sb = appendReplacementConceptReportHeader(sb);
sb.append(replacementConceptsSb);
} else {
sb = sb.append("n/a").append("\r\n");
}
sb.append("\r\n").append("Members in Common").append("\r\n");
sb = appendDiffReportHeader(sb);
sb.append(membersInCommonSb);
return new ByteArrayInputStream(sb.toString().getBytes("UTF-8"));
} catch (Exception e) {
......@@ -1198,6 +1236,16 @@ public class RefsetServiceRestImpl extends RootServiceRestImpl
sb.append("\r\n");
return sb;
}
private StringBuilder appendReplacementConceptReportHeader(StringBuilder sb) {
sb.append("Inactive ConceptID").append("\t");
sb.append("Inactive Concept FSN").append("\t");
sb.append("Reason").append("\t");
sb.append("Suggested Replacement ConceptID(s)").append("\t");
sb.append("Suggested Replacement FSN(s)").append("\t");
sb.append("\r\n");
return sb;
}
/**
* Append diff report member.
......@@ -1224,6 +1272,29 @@ public class RefsetServiceRestImpl extends RootServiceRestImpl
sb.append("\r\n");
return sb;
}
private StringBuilder appendReplacementConceptInfo(StringBuilder sb, ConceptRefsetMember member,
Concept c, RefsetService refsetService, String migrationTerminology, String migrationVersion)
throws Exception {
sb.append(member.getConceptId()).append("\t");
sb.append(member.getConceptName()).append("\t");
// given the reason code, look up the reason's name
Concept reasonConcept = null;
if (reasonMap.containsKey(c.getDefinitionStatusId())) {
reasonConcept = reasonMap.get(c.getDefinitionStatusId());
} else {
reasonConcept = refsetService.getTerminologyHandler(
member.getRefset().getProject(), getHeaders(headers)).getConcept(
c.getDefinitionStatusId(), migrationTerminology, migrationVersion);
reasonMap.put(c.getDefinitionStatusId(), reasonConcept);
}
sb.append(reasonConcept.getName()).append("\t");
sb.append(c.getTerminologyId()).append("\t");
sb.append(c.getName()).append("\r\n");
return sb;
}
@Override
@PUT
......@@ -1267,7 +1338,12 @@ public class RefsetServiceRestImpl extends RootServiceRestImpl
member.setConceptName(concept.getName());
member.setConceptActive(concept.isActive());
} else {
member.setConceptName(TerminologyHandler.UNABLE_TO_DETERMINE_NAME);
// RTT-249 request that concepts not validated, not be added
//member.setConceptName(TerminologyHandler.UNABLE_TO_DETERMINE_NAME);
addLogEntry(refsetService, userName, "ADD member failed lookup",
refset.getProject().getId(), refset.getId(),
refset.getTerminologyId() + " = " + member.getConceptId());
return null;
}
}
......
......@@ -831,7 +831,7 @@ public class ReleaseServiceRestImpl extends RootServiceRestImpl
}
ReleaseInfo info = translationService.getCurrentTranslationReleaseInfo(
translation.getTerminologyId(), translation.getProject().getId());
translation, translation.getProject().getId());
if (info != null) {
translationService.handleLazyInit(info);
......
......@@ -244,7 +244,8 @@ public class RootServiceRestImpl {
return map;
} else {
Logger.getLogger(getClass())
.warn("UNEXPECTED number of Cookie headers = " + cookies.size());
.warn("UNEXPECTED number of Cookie headers = " + cookies != null ?
cookies.size() : "null");
}
}
// else {
......
......@@ -187,11 +187,14 @@ tsApp.directive('conceptInfo', [
$scope.getDescriptionType = function(description) {
for (var i = 0; i < $scope.data.descriptionTypes.length; i++) {
var type = $scope.data.descriptionTypes[i];
if (description.typeId == type.typeId && description.languages && description.languages[0]
&& description.languages[0].acceptabilityId == type.acceptabilityId) {
return type.name;
if (description.typeId == type.typeId && description.languages){
for(var j = 0; j < description.languages.length; j++ ){
if(description.languages[j] && description.languages[j].acceptabilityId == type.acceptabilityId) {
return type.name;
}
}
}
}
}
return 'UNKNOWN';
};
......
......@@ -67,7 +67,7 @@
&nbsp;
<i ng-show="value == 'ASSIGNED' && isWarning(clause.value)"
uib-tooltip="{{warnings[clause.value]}}"
class="noul material-icons md-18">info_outline</i>
class="noul material-icons md-18" style="color: red;">info_outline</i>
</td>
</tr>
<tr ng-show="value == 'ASSIGNED'">
......
......@@ -150,18 +150,15 @@
ng-click="setSortField('membersInCommon','conceptId', null)">
Id</span> <span
ng-bind="getSortIndicator('membersInCommon','conceptId',null)"></span></th>
<th class="col-md-7 col-xs-7"><span
<th class="col-md-6 col-xs-6"><span
ng-click="setSortField('membersInCommon','conceptName', null)">
Name</span> <span
ng-bind="getSortIndicator('membersInCommon','conceptName',null)"></span></th>
<th class="col-md-1 col-xs-1"
ng-show="refset.type == 'EXTENSIONAL'"><select
title="Filter by status" style="width: 20px;"
ng-model="paging['membersInCommon'].typeFilter"
ng-options="item for item in statusTypes"
ng-change="findMembersInCommon()">
<option value="">All</option>
</select></th>
<th class="col-md-2 col-xs-2"
ng-show="refset.type == 'EXTENSIONAL'">
<select ng-model="membersInCommonStatusType" ng-change="findMembersInCommon()"
ng-options="item.state as item.name for item in statusTypes"></select>
</th>
</tr>
</thead>
<tbody>
......@@ -325,13 +322,9 @@
ng-click="setSortField('validInclusions','conceptName', null)">
Name</span> <span
ng-bind="getSortIndicator('validInclusions','conceptName',null)"></span></th>
<th class="col-md-1 col-xs-1"><select
title="Filter by status" style="width: 20px;"
ng-model="paging['validInclusions'].typeFilter"
ng-options="item for item in statusTypes"
ng-change="getPagedValidInclusions()">
<option value="">All</option>
</select></th>
<th class="col-md-1 col-xs-1">
<select ng-model="validInclusionsStatusType" ng-change="getPagedValidInclusions()"
ng-options="item.state as item.name for item in statusTypes"></select></th>
</tr>
</thead>
<tbody>
......@@ -399,13 +392,9 @@
ng-click="setSortField('stagedInclusions','conceptName', null)">
Name</span> <span
ng-bind="getSortIndicator('stagedInclusions','conceptName',null)"></span></th>
<th class="col-md-1 col-xs-1"><select
title="Filter by status" style="width: 20px;"
ng-model="paging['stagedInclusions'].typeFilter"
ng-options="item for item in statusTypes"
ng-change="getPagedStagedInclusions()">
<option value="">All</option>
</select></th>
<th class="col-md-1 col-xs-1">
<select ng-model="stagedInclusionsStatusType" ng-change="getPagedStagedInclusions()"
ng-options="item.state as item.name for item in statusTypes"></select></th>
</tr>
</thead>
<tbody>
......@@ -620,13 +609,9 @@
ng-click="setSortField('oldRegularMembers','conceptName', null)">
Name</span> <span
ng-bind="getSortIndicator('oldRegularMembers','conceptName',null)"></span></th>
<th class="col-md-1 col-xs-1"><select
title="Filter by status" style="width: 20px;"
ng-model="paging['oldRegularMembers'].typeFilter"
ng-options="item for item in statusTypes"
ng-change="getOldRegularMembers()">
<option value="">All</option>
</select></th>
<th class="col-md-1 col-xs-1">
<select ng-model="oldRegularMembersStatusType" ng-change="getOldRegularMembers()"
ng-options="item.state as item.name for item in statusTypes"></select></th>
</tr>
</thead>
<tbody>
......
......@@ -84,7 +84,7 @@
</div>
<div class="modal-footer">
<button class="btn btn-xs btn-primary" ng-disabled="selection.ids.length == 1"
<button class="btn btn-xs btn-primary" ng-disabled="getLength(selection.ids) < 2"
ng-click="submitAdd()">Submit</button>
<button class="btn btn-xs btn-warning" ng-click="cancel()">Cancel</button>
</div>
\ No newline at end of file
......@@ -26,7 +26,7 @@
<br />
</span>
<span ng-show="refset">
{{refset.moduleId}}
{{translation.moduleId}}
<span flag-icon obj="translation"></span>
{{refset.organization}}
</span>
......@@ -57,13 +57,17 @@
<div languages translation="translation"></div>
</td>
</tr>
<tr>
<tr ng-show="!refset.localSet">
<td>
<b>Module Id</b>
</td>
<td>
{{translation.moduleId}}
<span flag-icon obj="translation"></span>
<input style="width: 252px" ng-model="translation.moduleId"
placeholder="e.g. 900000000000207008" />
<button class="btn btn-xs btn-warning" ng-show="translation.moduleId"
ng-click="translation.moduleId=''">Clear</button>
&nbsp;&nbsp;
<span flag-icon obj="refset"></span>
</td>
</tr>
<tr>
......
......@@ -1199,8 +1199,8 @@ tsApp
$scope.warnings = [];
}
if (!translation.name || !translation.description || !translation.language) {
$scope.errors[0] = "Translation name, description, and language must not be empty.";
if (!translation.name || !translation.description || !translation.language || !translation.moduleId) {
$scope.errors[0] = "Translation name, description, module id and language must not be empty.";
return;
}
if (!translation.refsetId) {
......@@ -1919,9 +1919,9 @@ tsApp
},
ioHandlers : function() {
if (loperation == 'Import') {
return $scope.metadata.importHandlers;
return $scope.metadata.translationImportHandlers;
} else {
return $scope.metadata.exportHandlers;
return $scope.metadata.translationExportHandlers;
}
},
query : function() {
......@@ -1972,7 +1972,7 @@ tsApp
$scope.importFinished = false;
if (type == 'Translation' && ($scope.query || $scope.pfs)) {
$scope.warnings
.push("Export is based on current search criteria and may not include all concepts.");
.push(operation + " is based on current search criteria and may not include all concepts.");
}
// Handle export
......@@ -2191,7 +2191,7 @@ tsApp
return ltranslation;
},
ioHandlers : function() {
return $scope.metadata.exportHandlers;
return $scope.metadata.translationExportHandlers;
},
utilService : function() {
return utilService;
......
......@@ -20,7 +20,7 @@
</uib-accordion-heading>
<div class="col-md-12 col-xs-12">
<h4>
<span style="float: right;" ng-show="user.applicationRole == 'ADMIN'">
<span style="float: right;" ng-show="user.applicationRole == 'ADMIN' || user.applicationRole == 'USER'">
<button ng-click="openAddProjectModal()" title="Add project"
class="btn btn-xs btn-primary">Add Project</button>
</span>
......
......@@ -10,8 +10,9 @@ tsApp.controller('DirectoryCtrl',
'projectService',
'refsetService',
'workflowService',
'translationService',
function($scope, $http, $routeParams, tabService, utilService, securityService, projectService,
refsetService, workflowService) {
refsetService, workflowService, translationService) {
console.debug('configure DirectoryCtrl');
// Clear error
......@@ -153,10 +154,16 @@ tsApp.controller('DirectoryCtrl',
// Get $scope.metadata.{import,export}Handlers
$scope.getIOHandlers = function() {
refsetService.getImportRefsetHandlers().then(function(data) {
$scope.metadata.importHandlers = data.handlers;
$scope.metadata.refsetImportHandlers = data.handlers;
});
refsetService.getExportRefsetHandlers().then(function(data) {
$scope.metadata.exportHandlers = data.handlers;
$scope.metadata.refsetExportHandlers = data.handlers;
});
translationService.getImportTranslationHandlers().then(function(data) {
$scope.metadata.translationImportHandlers = data.handlers;
});
translationService.getExportTranslationHandlers().then(function(data) {
$scope.metadata.translationExportHandlers = data.handlers;
});
};
......
......@@ -225,10 +225,10 @@ tsApp
// Get $scope.metadata.{import,export}Handlers
$scope.getIOHandlers = function() {
refsetService.getImportRefsetHandlers().then(function(data) {
$scope.metadata.importHandlers = data.handlers;
$scope.metadata.refsetImportHandlers = data.handlers;
});
refsetService.getExportRefsetHandlers().then(function(data) {
$scope.metadata.exportHandlers = data.handlers;
$scope.metadata.refsetExportHandlers = data.handlers;
});
};
......
......@@ -215,10 +215,10 @@ tsApp
// Get $scope.metadata.{import,export}Handlers
$scope.getIOHandlers = function() {
translationService.getImportTranslationHandlers().then(function(data) {
$scope.metadata.importHandlers = data.handlers;
$scope.metadata.translationImportHandlers = data.handlers;
});
translationService.getExportTranslationHandlers().then(function(data) {
$scope.metadata.exportHandlers = data.handlers;
$scope.metadata.translationExportHandlers = data.handlers;
});
};
......
......@@ -903,12 +903,13 @@ tsApp.service('refsetService', [
});
};
this.exportDiffReport = function(action, reportToken, refset) {
this.exportDiffReport = function(action, reportToken, refset, migrationTerminology, migrationVersion) {
console.debug('exportDiffReport');
var deferred = $q.defer();
gpService.increment();
$http.get(
refsetUrl + 'export/report?reportToken=' + reportToken).then(
refsetUrl + 'export/report?reportToken=' + reportToken + '&terminology=' + migrationTerminology
+ '&version=' + migrationVersion).then(
// Success
function(response) {
var blob = new Blob([ response.data ], {
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>org.ihtsdo.otf.refset</groupId>
<artifactId>refset-parent</artifactId>
<version>1.1.3_a</version>
<version>1.1.4</version>
<relativePath>../parent</relativePath>
</parent>
......
......@@ -433,12 +433,12 @@ public interface TranslationService extends RefsetService {
/**
* Returns the current release info for translation.
*
* @param terminologyId the translation terminology id
* @param translation the translation terminology id
* @param projectId the project id
* @return the current release info for translation
* @throws Exception the exception
*/
public ReleaseInfo getCurrentTranslationReleaseInfo(String terminologyId,
public ReleaseInfo getCurrentTranslationReleaseInfo(Translation translation,
Long projectId) throws Exception;
/**
......