]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/URIResourceVariableAdapter.java
Merge "Added resourceId and GUID to diagram DnD content" into release/1.35.1
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / variable / URIResourceVariableAdapter.java
1 package org.simantics.db.layer0.variable;
2
3 import org.simantics.db.ReadGraph;
4 import org.simantics.db.Resource;
5 import org.simantics.db.common.adaption.SimpleAdapter;
6 import org.simantics.db.exception.AdaptionException;
7 import org.simantics.db.exception.AssumptionException;
8 import org.simantics.db.exception.DatabaseException;
9 import org.simantics.db.layer0.exception.MissingVariableException;
10
11 public class URIResourceVariableAdapter extends SimpleAdapter<Variable> {
12
13         @Override
14         public Variable adapt(ReadGraph g, Resource r) throws DatabaseException {
15             try {
16                 return Variables.getVariable(g, r);
17             } catch (MissingVariableException e) {
18             throw new AdaptionException("Variables.getVariable failed", e);
19             } catch (AssumptionException e) {
20                 throw new AdaptionException("Variables.getVariable failed", e);
21             }
22         }
23
24 }