1 package org.simantics.db.layer0.variable;
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;
10 public class VariableWriteWithComment extends WriteRequest {
12 private Variable variable;
14 private Binding binding;
15 private String comment;
17 public VariableWriteWithComment(Variable variable, Object value, Binding binding, String comment) {
18 this.variable = variable;
20 this.binding = binding;
21 this.comment = comment;
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));