Skip to content

Commit

Permalink
catalog: use panelLocked constant, #TASK-5964
Browse files Browse the repository at this point in the history
  • Loading branch information
pfurio committed Jul 5, 2024
1 parent fc068d4 commit 732f2ff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,8 @@ private OpenCGAResult<ClinicalAnalysis> update(String organizationId, Study stud

if (CollectionUtils.isNotEmpty(updateParamsClone.getPanels()) && updateParamsClone.getPanelLocked() != null
&& updateParamsClone.getPanelLocked()) {
throw new CatalogException("Updating the list of panels and setting 'panelLock' to true at the same time is not allowed.");
throw new CatalogException("Updating the list of panels and setting '"
+ ClinicalAnalysisDBAdaptor.QueryParams.PANEL_LOCKED.key() + "' to true at the same time is not allowed.");
}

if (CollectionUtils.isNotEmpty(updateParamsClone.getPanels())) {
Expand All @@ -1610,9 +1611,11 @@ private OpenCGAResult<ClinicalAnalysis> update(String organizationId, Study stud
// in order to set panelLock to true. Otherwise, that action is not allowed.
Set<String> panelIds = clinicalAnalysis.getPanels().stream().map(Panel::getId).collect(Collectors.toSet());
String exceptionMsgPrefix = "The interpretation '";
String exceptionMsgSuffix = "' does not contain any of the case panels. 'panelLock' can only be set to true if all"
String exceptionMsgSuffix = "' does not contain any of the case panels. '"
+ ClinicalAnalysisDBAdaptor.QueryParams.PANEL_LOCKED.key() + "' can only be set to true if all"
+ " all Interpretations contains a non-empty subset of the panels used by the case.";
String alternativeExceptionMsgSuffix = "' is using a panel not defined by the case. 'panelLock' can only be set to true if all"
String alternativeExceptionMsgSuffix = "' is using a panel not defined by the case. '"
+ ClinicalAnalysisDBAdaptor.QueryParams.PANEL_LOCKED.key() + "' can only be set to true if all"
+ " all Interpretations contains a non-empty subset of the panels used by the case.";
if (clinicalAnalysis.getInterpretation() != null) {
if (CollectionUtils.isEmpty(clinicalAnalysis.getInterpretation().getPanels())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ void validateNewInterpretation(String organizationId, Study study, Interpretatio
List<Panel> panelList = new ArrayList<>(clinicalPanelIds.size());
for (Panel panel : interpretation.getPanels()) {
if (!clinicalPanelIds.containsKey(panel.getId())) {
throw new CatalogException("'panelLock' from ClinicalAnalysis is set to True. Please, leave list of panels empty"
throw new CatalogException("'" + ClinicalAnalysisDBAdaptor.QueryParams.PANEL_LOCKED.key()
+ "' from ClinicalAnalysis is set to True. Please, leave list of panels empty"
+ " so they can be inherited or pass at least a subset of the panels defined in the Clinical Analysis.");
}
panelList.add(clinicalPanelIds.get(panel.getId()));
Expand Down Expand Up @@ -999,8 +1000,8 @@ private OpenCGAResult update(String organizationId, Study study, Interpretation

if (updateParams != null && CollectionUtils.isNotEmpty(updateParams.getPanels())) {
if (clinicalAnalysis.isPanelLocked()) {
throw new CatalogException("Updating panels from Interpretation is not allowed. 'panelLock' from ClinicalAnalysis is set "
+ "to True.");
throw new CatalogException("Updating panels from Interpretation is not allowed. '"
+ ClinicalAnalysisDBAdaptor.QueryParams.PANEL_LOCKED.key() + "' from ClinicalAnalysis is set to True.");
}

// Validate and get panels
Expand Down Expand Up @@ -1145,7 +1146,8 @@ public OpenCGAResult<Interpretation> revert(String studyStr, String clinicalAnal
+ " the Interpretation.");
}
if (clinicalAnalysis.isPanelLocked()) {
throw new CatalogException("Could not revert the Interpretation. 'panelLock' is set to True, so no further modifications"
throw new CatalogException("Could not revert the Interpretation. '"
+ ClinicalAnalysisDBAdaptor.QueryParams.PANEL_LOCKED.key() + "' is set to True, so no further modifications"
+ " can be made to the Interpretation.");
}

Expand Down

0 comments on commit 732f2ff

Please sign in to comment.