Commit 1a2b1736 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '616-disease-and-organism-can-not-be-removed' into 'master'

Resolve "Disease and Organism can not be removed"

Closes #616

See merge request !699
parents 9f8d1dac 5696ea56
Pipeline #9235 passed with stage
in 9 minutes and 19 seconds
......@@ -1104,6 +1104,13 @@ ServerConnector.updateProject = function (project) {
mapCanvasType: project.getMapCanvasType()
}
};
if (project.getOrganism() === undefined) {
filterParams.project.organism = "";
}
if (project.getDisease() === undefined) {
filterParams.project.disease = "";
}
return self.sendPatchRequest(self.getProjectUrl(queryParams), filterParams).then(function (content) {
var downloadedProject = new Project(content);
return project.update(downloadedProject);
......
......@@ -315,7 +315,7 @@ Project.prototype.getDisease = function () {
/**
*
* @param {AnnotationOptions|null} disease
* @param {AnnotationOptions|Annotation|null} disease
*/
Project.prototype.setDisease = function (disease) {
if (disease !== undefined && disease !== null) {
......@@ -335,7 +335,7 @@ Project.prototype.getOrganism = function () {
/**
*
* @param {AnnotationOptions|null} organism
* @param {AnnotationOptions|Annotation|null} organism
*/
Project.prototype.setOrganism = function (organism) {
if (organism !== undefined && organism !== null) {
......
......@@ -7,8 +7,8 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.LinkedHashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
......@@ -79,10 +79,10 @@ public class ProjectRestImpl extends BaseRestImpl {
private UploadedFileEntryDao uploadedFileEntryDao;
public ProjectRestImpl(PublicationsRestImpl publicationsRestImpl,
IProjectService projectService,
ProjectDao projectDao,
UploadedFileEntryDao uploadedFileEntryDao,
MeSHParser meshParser) {
IProjectService projectService,
ProjectDao projectDao,
UploadedFileEntryDao uploadedFileEntryDao,
MeSHParser meshParser) {
this.publicationsRestImpl = publicationsRestImpl;
this.projectService = projectService;
this.projectDao = projectDao;
......@@ -309,7 +309,7 @@ public class ProjectRestImpl extends BaseRestImpl {
if (meshParser.isValidMeshId(sourceData)) {
MiriamData disease = updateMiriamData(project.getDisease(), value);
project.setDisease(disease);
} else if (sourceData.getResource().isEmpty()) {
} else if (sourceData == null || sourceData.getResource().isEmpty()) {
project.setDisease(null);
} else {
throw new QueryException("invalid mesh identifier: " + value);
......@@ -334,7 +334,7 @@ public class ProjectRestImpl extends BaseRestImpl {
}
private MiriamData updateMiriamData(MiriamData organism, Object res) {
if (res == null) {
if (res == null || res.equals("")) {
return null;
}
if (organism == null) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment