Commit 795473db authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch 'devel_12.0.x'

parents 35ceb91b abcc5452
......@@ -14,6 +14,15 @@ minerva (12.1.0~alpha.0) experimental; urgency=medium
-- Piotr Gawron <piotr.gawron@uni.lu> Fri, 03 Aug 2018 10:00:00 +0200
minerva (12.0.3) stable; urgency=medium
* Bug fix: SBML model annotations caused errors on upload
* Bug fix: Export of some models to SBML didn't work properly
* Bug fix: zip files weren't processed properly
* Bug fix: required annotations were always required for some types
* Bug fix: user cannot remove default map anymore
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 27 Aug 2018 11:00:00 +0200
minerva (12.0.2) stable; urgency=medium
* Bug fix: data overlay by annotation type fixed
* Bug fix: [plugin] getting reactions with set of id larger than 100 elements
......
......@@ -19,11 +19,11 @@ import org.sbml.jsbml.SBMLReader;
import org.sbml.jsbml.ext.SBasePlugin;
import org.sbml.jsbml.ext.layout.Layout;
import org.sbml.jsbml.ext.layout.LayoutModelPlugin;
import org.sbml.jsbml.util.NotImplementedException;
import lcsb.mapviewer.commands.CommandExecutionException;
import lcsb.mapviewer.commands.layout.ApplySimpleLayoutModelCommand;
import lcsb.mapviewer.common.MimeType;
import lcsb.mapviewer.common.exception.NotImplementedException;
import lcsb.mapviewer.converter.ConverterException;
import lcsb.mapviewer.converter.ConverterParams;
import lcsb.mapviewer.converter.IConverter;
......@@ -103,13 +103,10 @@ public class SbmlParser implements IConverter {
throw new NotImplementedException("ConversionFactor not implemented for model");
}
if (sbmlModel.getCVTermCount() > 0) {
throw new NotImplementedException("CVTerms not implemented for model");
logger.warn("Handling of CVTerms is not implemented for model");
}
if (sbmlModel.getEventCount() > 0) {
throw new NotImplementedException("Events not implemented for model");
}
if (sbmlModel.getEventAssignmentCount() > 0) {
throw new NotImplementedException("EventAssignemnts not implemented for model");
if (sbmlModel.getEventCount() > 0 || sbmlModel.getEventAssignmentCount() > 0) {
logger.warn("Handling of Events is not implemented for model");
}
if (sbmlModel.getInitialAssignmentCount() > 0) {
throw new NotImplementedException("InitialAssignment not implemented for model");
......
......@@ -103,8 +103,12 @@ public class SbmlReactionExporter extends SbmlBioEntityExporter<Reaction, org.sb
LocalParameter parameter = new LocalParameter();
parameter.setId(minervaParameter.getElementId());
parameter.setName(minervaParameter.getName());
parameter.setValue(minervaParameter.getValue());
parameter.setUnits(minervaParameter.getUnits().getUnitId());
if (minervaParameter.getValue() != null) {
parameter.setValue(minervaParameter.getValue());
}
if (minervaParameter.getUnits() != null) {
parameter.setUnits(minervaParameter.getUnits().getUnitId());
}
result.addLocalParameter(parameter);
}
}
......
......@@ -13,7 +13,10 @@ import lcsb.mapviewer.converter.model.sbml.SbmlBioEntityExporter;
import lcsb.mapviewer.converter.model.sbml.SbmlCompartmentExporter;
import lcsb.mapviewer.converter.model.sbml.species.SbmlSpeciesExporter;
import lcsb.mapviewer.model.map.InconsistentModelException;
import lcsb.mapviewer.model.map.kinetics.SbmlKinetics;
import lcsb.mapviewer.model.map.kinetics.SbmlParameter;
import lcsb.mapviewer.model.map.model.ModelFullIndexed;
import lcsb.mapviewer.model.map.reaction.Reaction;
import lcsb.mapviewer.model.map.reaction.type.TriggerReaction;
import lcsb.mapviewer.model.map.species.Species;
......@@ -28,6 +31,22 @@ public class SbmlReactionExporterTest {
assertNotNull(result);
}
@Test
public void testReactionWithKineticsWithoutUnitsToSbml() throws InconsistentModelException {
ModelFullIndexed model = new ModelFullIndexed(null);
SbmlReactionExporter exporter = createExporter(model);
Reaction reaction = new TriggerReaction();
SbmlKinetics kinetics = new SbmlKinetics();
reaction.setKinetics(kinetics);
kinetics.setDefinition("<lambda>" + "<bvar><ci> x </ci></bvar>" + "<bvar><ci> y </ci></bvar>"
+ "<apply><plus/><ci> x </ci><ci> x </ci><cn type=\"integer\"> 2 </cn></apply>" + "</lambda>\n\n");
SbmlParameter parameter = new SbmlParameter("x");
kinetics.addParameter(parameter);
org.sbml.jsbml.Reaction result = exporter.createSbmlElement(reaction);
assertNotNull(result);
}
private SbmlReactionExporter createExporter(ModelFullIndexed model) {
SBMLDocument doc = new SBMLDocument(3, 1);
Model result = doc.createModel(model.getIdModel());
......
......@@ -625,7 +625,11 @@ Configuration.prototype.getElementTypeTree = function () {
var treeNodes = {
"lcsb.mapviewer.model.map.BioEntity": {
text: "BioEntity",
children: []
children: [],
data: {
className: "lcsb.mapviewer.model.map.BioEntity",
name: "BioEntity"
}
}
};
......@@ -655,7 +659,7 @@ Configuration.prototype.getElementTypeTree = function () {
for (var treeNodeName in treeNodes) {
if (treeNodes.hasOwnProperty(treeNodeName)) {
var treeNode = treeNodes[treeNodeName];
if (treeNode.data !== undefined) {
if (treeNode.data !== undefined && treeNode.data.parentClass !== undefined) {
var parentNode = treeNodes[treeNode.data.parentClass];
if (parentNode.data === undefined || parentNode.data.name !== "Compartment") {
parentNode.children.push(treeNode);
......
......@@ -42,6 +42,7 @@ var GuiConnector = require('./GuiConnector');
var ObjectWithListeners = require('./ObjectWithListeners');
var Point = require('./map/canvas/Point');
var ZipEntry = require('./gui/admin/ZipEntry');
/**
* This object contains methods that will communicate with server.
......@@ -309,7 +310,12 @@ ServerConnector.objectToRequestString = function (object) {
if (object instanceof Point) {
value = this.pointToString(object);
} else if (Object.prototype.toString.call(object) === '[object Array]') {
value = this.idsToString(object);
var arrayObject = object[0];
if (arrayObject instanceof ZipEntry) {
value = object;
} else {
value = this.idsToString(object);
}
} else if (object === null) {
value = undefined;
} else if (typeof object === 'string' || object instanceof String || !isNaN(object)) {
......
......@@ -7,6 +7,7 @@ var AddProjectDialog = require('./AddProjectDialog');
var EditProjectDialog = require('./EditProjectDialog');
var LogListDialog = require('./LogListDialog');
var PrivilegeType = require('../../map/data/PrivilegeType');
var ConfigurationType = require('../../ConfigurationType');
var UserPreferences = require('../../map/data/UserPreferences');
// noinspection JSUnusedLocalSymbols
......@@ -234,6 +235,10 @@ MapsAdminPanel.prototype.projectToTableRow = function (project, row, user) {
disabled = "";
}
row[5] = "<button name='showEditDialog' data='" + project.getProjectId() + "'" + disabled + "><i class='fa fa-edit' style='font-size:17px'></i></button>";
if (self.getConfiguration().getOption(ConfigurationType.DEFAULT_MAP).getValue() === projectId) {
disabled = " disabled ";
}
row[6] = "<button name='removeProject' data='" + project.getProjectId() + "'" + disabled + "><i class='fa fa-trash-o' style='font-size:17px'></button>";
return row;
......
......@@ -167,7 +167,7 @@ public enum ConfigurationElementType {
/**
* Opacity of data overlay objects in the frontend.
*/
OVERLAY_OPACITY("Opacity used when drwaing data overlays (value between 0.0-1.0)", "0.8",
OVERLAY_OPACITY("Opacity used when drawing data overlays (value between 0.0-1.0)", "0.8",
ConfigurationElementEditType.DOUBLE, false, ConfigurationElementTypeGroup.OVERLAYS),
/**
......
......@@ -337,6 +337,15 @@ public class UserAnnotationSchema implements Serializable {
return new ArrayList<MiriamType>();
}
public boolean requiresAtLeastOneAnnotation(Class<?> clazz) {
for (UserClassRequiredAnnotations cva : classRequiredAnnotators) {
if (cva.getClassName().equals(clazz.getCanonicalName())) {
return cva.getRequireAtLeastOneAnnotation();
}
}
return false;
}
/**
* @return the classRequiredAnnotators
* @see #classRequiredAnnotators
......
-- empty file to force directory to be commited to git repo
......@@ -46,6 +46,7 @@ import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.reaction.Reaction;
import lcsb.mapviewer.model.map.species.Element;
import lcsb.mapviewer.services.SecurityException;
import lcsb.mapviewer.services.interfaces.IConfigurationService;
import lcsb.mapviewer.services.interfaces.IModelService;
import lcsb.mapviewer.services.interfaces.IProjectService;
import lcsb.mapviewer.services.interfaces.IUserService;
......@@ -68,6 +69,9 @@ public abstract class BaseRestImpl {
@Autowired
private IUserService userService;
@Autowired
private IConfigurationService configurationService;
@Autowired
private MiriamConnector miriamConnector;
......@@ -375,4 +379,12 @@ public abstract class BaseRestImpl {
}
}
public IConfigurationService getConfigurationService() {
return configurationService;
}
public void setConfigurationService(IConfigurationService configurationService) {
this.configurationService = configurationService;
}
}
......@@ -24,7 +24,6 @@ import java.util.TreeMap;
import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;
import org.primefaces.model.map.LatLng;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.MultiValueMap;
......@@ -73,6 +72,7 @@ import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.model.SubmodelType;
import lcsb.mapviewer.model.map.reaction.Reaction;
import lcsb.mapviewer.model.map.species.Element;
import lcsb.mapviewer.model.user.ConfigurationElementType;
import lcsb.mapviewer.model.user.PrivilegeType;
import lcsb.mapviewer.model.user.User;
import lcsb.mapviewer.persist.dao.ProjectDao;
......@@ -362,11 +362,11 @@ public class ProjectRestImpl extends BaseRestImpl {
List<Point2D> points = new ArrayList<>();
for (String string : stringPointArray) {
if (!string.trim().equals("")) {
double x = Double.valueOf(string.split(",")[0]);
double y= Double.valueOf(string.split(",")[1]);
points.add(new Point2D.Double(x, y));
}
if (!string.trim().equals("")) {
double x = Double.valueOf(string.split(",")[0]);
double y = Double.valueOf(string.split(",")[1]);
points.add(new Point2D.Double(x, y));
}
}
if (points.size() <= 2) {
......@@ -375,13 +375,13 @@ public class ProjectRestImpl extends BaseRestImpl {
points.add(new Point2D.Double(colorModel.getWidth(), 0));
points.add(new Point2D.Double(colorModel.getWidth(), colorModel.getHeight()));
points.add(new Point2D.Double(0, colorModel.getHeight()));
}
}
Path2D polygon = new Path2D.Double();
polygon.moveTo(points.get(0).getX(), points.get(0).getY());
for (int i = 1; i < points.size(); i++) {
Point2D point = points.get(i);
polygon.lineTo(point.getX(), point.getY());
Point2D point = points.get(i);
polygon.lineTo(point.getX(), point.getY());
}
polygon.closePath();
return polygon;
......@@ -736,8 +736,11 @@ public class ProjectRestImpl extends BaseRestImpl {
}
public Map<String, Object> removeProject(String token, String projectId, String path)
throws ObjectNotFoundException, SecurityException {
throws SecurityException, QueryException {
Project project = getProjectService().getProjectByProjectId(projectId, token);
if (getConfigurationService().getConfigurationValue(ConfigurationElementType.DEFAULT_MAP).equals(project.getProjectId())) {
throw new QueryException("You cannot remove default map");
}
getProjectService().removeProject(project, path, true, token);
return getProject(projectId, token);
}
......
......@@ -1138,6 +1138,7 @@ public class ProjectService implements IProjectService {
ClassTreeNode top = elementUtils.getAnnotatedElementClassTree();
Class<?> clazz = top.getClazz();
top.setData(annotationSchema.requiresAtLeastOneAnnotation(clazz));
TreeNode root = new DefaultTreeNode(new AnnotatedObjectTreeRow(top, modelAnnotator.getAvailableAnnotators(clazz),
modelAnnotator.getAnnotatorsFromCommonNames(annotationSchema.getAnnotatorsForClass(clazz)),
annotationSchema.getValidAnnotations(clazz), annotationSchema.getRequiredAnnotations(clazz)), null);
......@@ -1156,6 +1157,7 @@ public class ProjectService implements IProjectService {
for (ClassTreeNode node : element.getLeft().getChildren()) {
clazz = node.getClazz();
node.setData(annotationSchema.requiresAtLeastOneAnnotation(clazz));
AnnotatedObjectTreeRow data = new AnnotatedObjectTreeRow(node, modelAnnotator.getAvailableAnnotators(clazz),
modelAnnotator.getAnnotatorsFromCommonNames(annotationSchema.getAnnotatorsForClass(clazz)),
annotationSchema.getValidAnnotations(clazz), annotationSchema.getRequiredAnnotations(clazz));
......
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