Skip to content
Snippets Groups Projects
Commit f4e37037 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

number of publication should be in project scope

parent 066b615b
No related branches found
No related tags found
1 merge request!5Frontend refactor
...@@ -3,21 +3,15 @@ package lcsb.mapviewer.api.project; ...@@ -3,21 +3,15 @@ package lcsb.mapviewer.api.project;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import org.primefaces.model.map.LatLng; import org.primefaces.model.map.LatLng;
import lcsb.mapviewer.common.Configuration; import lcsb.mapviewer.common.Configuration;
import lcsb.mapviewer.model.map.MiriamData;
import lcsb.mapviewer.model.map.MiriamType;
import lcsb.mapviewer.model.map.layout.Layout; import lcsb.mapviewer.model.map.layout.Layout;
import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.model.ModelData; import lcsb.mapviewer.model.map.model.ModelData;
import lcsb.mapviewer.model.map.model.ModelSubmodelConnection; import lcsb.mapviewer.model.map.model.ModelSubmodelConnection;
import lcsb.mapviewer.model.map.reaction.Reaction;
import lcsb.mapviewer.model.map.species.Element;
import lcsb.mapviewer.services.utils.gmap.CoordinationConverter; import lcsb.mapviewer.services.utils.gmap.CoordinationConverter;
import lcsb.mapviewer.services.view.LayoutView; import lcsb.mapviewer.services.view.LayoutView;
import lcsb.mapviewer.services.view.LayoutViewFactory; import lcsb.mapviewer.services.view.LayoutViewFactory;
...@@ -41,8 +35,6 @@ public class ModelMetaData implements Serializable { ...@@ -41,8 +35,6 @@ public class ModelMetaData implements Serializable {
private Integer idObject; private Integer idObject;
private Integer publicationCount;
/** /**
* Size in pixels of the single square tile (small image used for graphical * Size in pixels of the single square tile (small image used for graphical
* representation). * representation).
...@@ -119,31 +111,6 @@ public class ModelMetaData implements Serializable { ...@@ -119,31 +111,6 @@ public class ModelMetaData implements Serializable {
} }
this.setSubmodels(submodels); this.setSubmodels(submodels);
Set<MiriamData> publications = new HashSet<>();
List<ModelData> models = new ArrayList<>();
for (ModelSubmodelConnection connection : model.getSubmodels()) {
models.add(connection.getSubmodel());
}
models.add(model);
for (ModelData modelData : models) {
for (Element element : modelData.getElements()) {
for (MiriamData md : element.getMiriamData()) {
if (md.getDataType().equals(MiriamType.PUBMED)) {
publications.add(md);
}
}
}
for (Reaction reaction : modelData.getReactions()) {
for (MiriamData md : reaction.getMiriamData()) {
if (md.getDataType().equals(MiriamType.PUBMED)) {
publications.add(md);
}
}
}
}
this.setPublicationCount(publications.size());
} }
protected ModelMetaData() { protected ModelMetaData() {
...@@ -370,20 +337,4 @@ public class ModelMetaData implements Serializable { ...@@ -370,20 +337,4 @@ public class ModelMetaData implements Serializable {
this.idObject = idObject; this.idObject = idObject;
} }
/**
* @return the publicationCount
* @see #publicationCount
*/
public Integer getPublicationCount() {
return publicationCount;
}
/**
* @param publicationCount
* the publicationCount to set
* @see #publicationCount
*/
public void setPublicationCount(Integer publicationCount) {
this.publicationCount = publicationCount;
}
} }
package lcsb.mapviewer.api.project; package lcsb.mapviewer.api.project;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import lcsb.mapviewer.model.Project;
import lcsb.mapviewer.model.map.OverviewImage;
import lcsb.mapviewer.model.map.OverviewImageLink;
import lcsb.mapviewer.model.map.OverviewLink;
import lcsb.mapviewer.model.map.model.ModelData;
import lcsb.mapviewer.services.view.AnnotationView; import lcsb.mapviewer.services.view.AnnotationView;
import lcsb.mapviewer.services.view.OverviewImageView; import lcsb.mapviewer.services.view.OverviewImageView;
import lcsb.mapviewer.services.view.OverviewImageViewFactory;
public class ProjectMetaData implements Serializable { public class ProjectMetaData implements Serializable {
...@@ -53,6 +45,8 @@ public class ProjectMetaData implements Serializable { ...@@ -53,6 +45,8 @@ public class ProjectMetaData implements Serializable {
private ModelMetaData map; private ModelMetaData map;
private Integer publicationCount;
/** /**
* List of overview images attached to this model. * List of overview images attached to this model.
*/ */
...@@ -69,7 +63,6 @@ public class ProjectMetaData implements Serializable { ...@@ -69,7 +63,6 @@ public class ProjectMetaData implements Serializable {
protected ProjectMetaData() { protected ProjectMetaData() {
} }
/** /**
* @return the version * @return the version
* @see #version * @see #version
...@@ -240,4 +233,21 @@ public class ProjectMetaData implements Serializable { ...@@ -240,4 +233,21 @@ public class ProjectMetaData implements Serializable {
this.organism = organism; this.organism = organism;
} }
/**
* @return the publicationCount
* @see #publicationCount
*/
public Integer getPublicationCount() {
return publicationCount;
}
/**
* @param publicationCount
* the publicationCount to set
* @see #publicationCount
*/
public void setPublicationCount(Integer publicationCount) {
this.publicationCount = publicationCount;
}
} }
...@@ -17,11 +17,14 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -17,11 +17,14 @@ import org.springframework.web.bind.annotation.RequestParam;
import lcsb.mapviewer.common.exception.InvalidStateException; import lcsb.mapviewer.common.exception.InvalidStateException;
import lcsb.mapviewer.model.Project; import lcsb.mapviewer.model.Project;
import lcsb.mapviewer.model.map.MiriamData;
import lcsb.mapviewer.model.map.MiriamType;
import lcsb.mapviewer.model.map.OverviewImage; import lcsb.mapviewer.model.map.OverviewImage;
import lcsb.mapviewer.model.map.OverviewImageLink; import lcsb.mapviewer.model.map.OverviewImageLink;
import lcsb.mapviewer.model.map.OverviewLink; import lcsb.mapviewer.model.map.OverviewLink;
import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.model.ModelData; import lcsb.mapviewer.model.map.model.ModelData;
import lcsb.mapviewer.model.map.model.ModelSubmodelConnection;
import lcsb.mapviewer.model.map.reaction.Modifier; import lcsb.mapviewer.model.map.reaction.Modifier;
import lcsb.mapviewer.model.map.reaction.Product; import lcsb.mapviewer.model.map.reaction.Product;
import lcsb.mapviewer.model.map.reaction.Reactant; import lcsb.mapviewer.model.map.reaction.Reactant;
...@@ -106,8 +109,35 @@ public class ProjectRestImpl { ...@@ -106,8 +109,35 @@ public class ProjectRestImpl {
result.setTopOverviewImage(factory.create(model.getOverviewImages().get(0))); result.setTopOverviewImage(factory.create(model.getOverviewImages().get(0)));
} }
result.setMap(new ModelMetaData(model)); result.setMap(new ModelMetaData(model));
Set<MiriamData> publications = new HashSet<>();
List<ModelData> models = new ArrayList<>();
for (ModelSubmodelConnection connection : model.getSubmodels()) {
models.add(connection.getSubmodel());
}
models.add(model);
for (ModelData modelData : models) {
for (Element element : modelData.getElements()) {
for (MiriamData md : element.getMiriamData()) {
if (md.getDataType().equals(MiriamType.PUBMED)) {
publications.add(md);
}
}
}
for (Reaction reaction : modelData.getReactions()) {
for (MiriamData md : reaction.getMiriamData()) {
if (md.getDataType().equals(MiriamType.PUBMED)) {
publications.add(md);
}
}
}
}
result.setPublicationCount(publications.size());
} }
return result; return result;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment