]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/VariableWriteWithComment.java
Fixed invalid comparisons which were identified by Eclipse IDE 2018-09
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / variable / VariableWriteWithComment.java
1 package org.simantics.db.layer0.variable;
2
3 import org.simantics.databoard.binding.Binding;
4 import org.simantics.db.WriteGraph;
5 import org.simantics.db.common.CommentMetadata;
6 import org.simantics.db.common.request.WriteRequest;
7 import org.simantics.db.exception.DatabaseException;
8 import org.simantics.db.layer0.variable.Variable;
9
10 public class VariableWriteWithComment extends WriteRequest {
11
12     private Variable variable;
13     private Object   value;
14     private Binding  binding;
15     private String   comment;
16
17     public VariableWriteWithComment(Variable variable, Object value, Binding binding, String comment) {
18         this.variable = variable;
19         this.value = value;
20         this.binding = binding;
21         this.comment = comment;
22     }
23
24     @Override
25     public void perform(WriteGraph graph) throws DatabaseException {
26         variable.setValue(graph, value, binding);
27         if (comment != null) {
28             CommentMetadata m = graph.getMetadata(CommentMetadata.class);
29             graph.addMetadata(m.add(comment));
30         }
31     }
32
33 }